jQuery动画

show() 显示隐藏的匹配元素
//将选中的元素显示出来
$("p").show();

//将选中的元素缓慢的显示出来,有slow、normal、fast 或者是毫秒数
$("p").show("slow");

//回调函数,完成效果后执行这个函数
$("p").show("fast",function(){
   $(this).text("show time !");

 });


hide() 隐藏显示的元素
//将选中的元素隐藏出来
$("p").hide();

//将选中的元素缓慢的隐藏出来,有slow、normal、fast 或者是毫秒数
$("p").hide("slow");

//回调函数,完成效果后执行这个函数
$("p").hide("fast",function(){
  alert($(this).text());
 });


fadeIn() 改变不透明度,直到显示
fadeOut() 改变不透明度,直到"消失"
slideUp() 改变高度,直到隐藏
slideDown()         改变高度,直到完全显示

animate() 自定义动画
可以根据自己的需要进行定制动画。
//同时执行
 $(".one").animate({ 
    width: "800px",
    height: "500px", 
    fontSize: "20px", 
    borderWidth:'10px'
}, 1000 );



//顺序执行
$(".one").animate({
    width:"800px"
},3000).animate({
    height:"500px"
},2000).animate({
    fontSize :"30px"
},2000);

stop() 清除队列,避免动画循环
$('.one').hover(function(){

     $(this).stop().animate({width:"300px",height:"400px"},1000);
},function(){
    $(this).stop().animate({width:"200px",height:"200px"},1000);
});


其他动画:
toggle() slidToggle()
fadeTo() fadeToggle()


Copyright © 2016-2019 709173702@qq.com 版权所有  ICP证粤ICP备16117826号-1
联系邮箱:709173702@qq.com