jQuery

效果:

  hide()  隐藏

    hide(2000)  ---2000为效果持续时长(毫秒)

  show()  显示

  fadeIn()  淡入

  fadeOut()  淡出

  slideUp()  向上收

  slideDown()  向下展

  animate()  通过CSS样式的渐变来创建动画效果

    animate({marginLeft:-300},"slow","linear",function(){})

    animate({marginLeft:"-300px"},1000,function(){})

      参数styles:必填,可改变的CSS样式:backgroundPosition、borderWidth、borderBottomWidth、borderLeftWidth、borderRightWidth、borderTopWidth、borderSpacing、margin、marginBottom、marginLeft、marginRight、marginTop、outlineWidth、padding、paddingBottom、paddingLeft、paddingRight、paddingTop、height、width、maxHeight、maxWidth、minHeight、minWidth、font、fontSize、bottom、left、right、top、letterSpacing、wordSpacing、lineHeight、textIndent

      参数speed:可选,动画的速度:"normal"(默认)、"slow"、"fast"、毫秒数(1000)

      参数easing:可选,设置在动画的不同点中元素的速度:"swing"(开头结尾移动慢,中间移动快)、"linear"(匀速移动)

      参数callback:可选,动画完成后要执行的函数

事件:

  bind("事件类型1 事件类型2",fn)  绑定一个或多个事件

  on("事件类型1 事件类型2",fn)  绑定一个或多个事件

  click(fn)  点击

  mouseover(fn)  鼠标经过

  mouseout(fn)  鼠标离开

  hover(fn, fn)  鼠标经过离开切换

  toggle(fn, fn)  点击切换

语法:

  <script>

    $(function(){

      $("谁").干什么;

    });

  </script>

  <script>

    $(function(){

      $(".aBtn").click(function(){

        $(".box").hide(1000);

      });

    });

  </script>

  index方法:index($(this))可以由代码帮你找当前对象的顺序号

    var n=$("div").index($(this));

  $("div a").eq(0).hide();  eq()---指定第几个

    children("")  子级

    parent("")  父级

    siblings("")  同辈

    next("")  下一个

    prev("")  上一个

控制标签值

  var value=$("").val();

控制标签的CSS修饰

  $("div a,div p").css("color","red");

  $("div a").addClass("currentA");  此处的选择器名是无需加“.”的

  $("div a").removeClass("currentA");  此处的选择器名是无需加“.”的

控制标签属性

  $("#img01").attr("src","./images/01.png");

  $("#checked").prop("checked",true);

posted @ 2018-04-24 15:48  Autumn_n  阅读(150)  评论(0编辑  收藏  举报
TOP