jquery animate step 实现 transform css3方法
来源:互联网 发布:java的历史 编辑:程序博客网 时间:2024/05/18 13:25
animate()方法有个step参数规定动画执行的每一步都要执行step这个回调函数。
我们可以用使用一个不影响元素效果显著的css值来触发animate()开发方法 ,然后在step回调函数中修改我们想要修改的值,这样就可以间接地实现动画了
实例:
<style type="text/css"> .demo { width: 100px; height: 100px; border: 1px solid red; }</style>
<div class="demo"></div><button>sss</button><script type="text/javascript" src="jquery-1.11.1.min.js"></script><script type="text/javascript"> $("button").click(function(){ $(".demo").animate({ aa:"360" //目的就是取一个属性值360 },{ step:function(now,fx){ //console.log(now); $(".demo").css({"transform":"rotate("+now+"deg)"}) }, duration:1000 }); })</script><script> $(".demo").animate({ aa:2, bb:10 }, { step:function(now,fx){ //参数step:规定每个动画的每一步完成之后要执行的函数 // now:是当前动画正在改变的属性的实时值; // fx: jQuery.fx 原型对象的一个引用,其中包含了多项属性,比如 // 执行动画的元素:elem; // 动画正在改变的属性:prop; // 正在改变属性的当前值:now; // 正在改变属性的结束值:end; // 正在改变属性的单位:unit;等 // 可在这里改变animate第1个参数中设置的属性bb在动画结束时的值 if(fx.prop=="bb"){fx.end=5} //console.log(fx.prop+": "+n); }, duration:1000 })</script>
0 0
- jquery animate step 实现 transform css3方法
- jquery animate step 实现 transform css3方法
- Jquery使用animate实现css3的transform动画效果
- jquery中animate方法不支持transform属性的解决
- jQuery animate a -webkit-transform
- jQuery--animate() 方法
- jQuery animate方法
- 【jQuery】 效果 - animate() 方法
- jQuery animate方法
- jQuery 效果 - animate() 方法
- jQuery 动画 - animate() 方法
- jQuery 效果 - animate() 方法
- jQuery 效果 - animate() 方法
- jQuery 效果 - animate() 方法
- jQuery 效果 - animate() 方法
- jQuery 效果 - animate() 方法
- jQuery--animate()方法
- 关于JQuery animate()方法
- 复习JAVA面相对象(类和对象)
- 15 sql语言基础与qt里sqlite, mysql数据库的连接
- 第三方登陆--狸菇凉_
- 页面侧滑2
- printf 打印 指定长度 字符串
- jquery animate step 实现 transform css3方法
- SpringBoot 相关的注意点
- 选择排序及其优化方案
- solr 两种预热方式
- 惠州学院-数据库实验3-数据库中数据的更新
- ThinkPHP与PHP的上传与下载
- js兼容的一些方式
- 04-树6 Complete Binary Search Tree (30分)
- 使用tf库:编写tf广播器(C++)