jquery的一些笔记

show
hide
toggle

toggle能实现show 和hide的来回切换
toggle(中文翻译是切换)

=========================================
$("#b7").click(function(){
$("#d1").fadeTo("slow",0.2);
$("#d2").fadeTo("slow",0.5);
$("#d3").fadeTo("slow",0.8);
});

透明度

通过animate 可以实现更为丰富的动画效果
animate()第一个参数为css样式
animate()第二个参数为延时毫秒
注: 默认情况下,html中的元素都是固定,并且无法改变的位置的。 为了使用animate()自定义动画效果,需要通过css把元素的position设置为relative、absolute或者fixed。

 $("#b1").click(function(){
    div.animate({left:'100px'},2000);
    div.animate({left:'0px',top:'50px',height:'50px'},2000);
   });

===============
回调函数:
div.animate({left:'0px',top:'50px',height:'50px'},2000,function(){
alert("动画演示结束");
});

====================

猜你喜欢

转载自www.cnblogs.com/czy16/p/8926055.html