FCC-Front End Development jQuery

知识点:

  1. jQuery只是用JavaScript写的一个库。
  2. 下面这个documet ready function实在网页被加载完成之后才会开始工作的。

    $(document).ready(function() {
     });
  3. Now let’s write our first jQuery statement. All jQuery functions start with a $, usually referred to as a dollar sign operator, or as bling.jQuery often selects an HTML element with a selector, then does something to that element.For example, let’s make all of your button elements bounce. Just add this code inside your document ready function:$("button").addClass("animated bounce");注意标签名要用双引号包括起来,addClass就是给所有的button加上一个额外的类。

  4. $(".well").addClass("animated shake"); 是给well类加动画效果,well前面有一个英文句号哦!而且所有的都用双引号!
  5. $("#target3").addClass("animated fadeout");是给id为target3的元素加动画效果。
  6. 有addClass当然也会有removeClass辣!使用方法目前看来是一致的。
  7. jQuery has a function called .css() that allows you to change the CSS of an element.Here’s how we would change its color to blue:$("#target1").css("color", "blue");. The CSS property and its value are in quotes, and separated with a comma instead of a colon.
  8. jQuery has a function called .prop() that allows you to adjust the properties of elements.Here’s how you would disable all buttons:$("button").prop("disabled", true);.
  9. jQuery function:text(), that only alters text without adding tags. jQuery has a function called .html() that lets you add HTML tags and text within an element. Any content previously within the element will be completely replaced with the content you provide using this function, for example:

    $("#target4").html("<em>#target4</em>");
    $("#target2").text("hi");
  10. jQuery has a function called .remove() that will remove an HTML element entirely .

  11. jQuery has a function called appendTo() that allows you to select HTML elements and append them to another element.
  12. jQuery has a function called clone() that makes a copy of an element.For example, if we wanted to copy not replace “target2” to “#right-well”, we would use:$("#target2").clone().appendTo("#right-well"); This is called function chaining and it’s a convenient way to get things done with jQuery.
  13. jQuery has a function called parent() that allows you to access the parent of whichever element you’ve selected.
  14. jQuery has a function called children() that allows you to access the children of whichever element you’ve selected.
  15. jQuery uses CSS Selectors to target elements. target:nth-child(n) css selector allows you to select all the nth elements with the target class or element type.Here’s how you would give the third element in each well the bounce class:$(".target:nth-child(3)").addClass("animated bounce");
  16. Another CSS selector: odd or even.$(".target:odd").addClass("animated shake");
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值