- css3和jquery的animate在一起怎么没有想要的效果呢?
问题描述
<!DOCTYPE html><html><head><script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script><script> $(document).ready(function(){ $('button').click(function(){ $('p').animate({ width:’200px’, height:’200px’, transform:’rotate(360deg)’; -webkit-transform:’rotate(360deg)’; }); });});</script></head><body><button>开始动画</button><p style='width:100px; height:100px; background:yellow; transition:width 2s, height 2s; -webkit-transition:width 2s, height 2s, -webkit-transform 2s;'></p></body></html>
如果想实现这种效果(我鼠标点“开始动画”然后p就转一圈然后fadeOut)该怎么写呢?
问题解答
回答1:js语法错误,取消掉错误以后直接用css就可以触发css3动画
$('button').click(function(){ $('p').css({ ’width’:’200px’, ’height’:’200px’, ’transform’:’rotate(360deg)’, ’-webkit-transform’:’rotate(360deg)’ }); });
当然了,还是不建议jquery动画和css3动画混用,帮你用css3写了一个效果,你看着改一下吧http://jsfiddle.net/Fmdrx/
回答2:JS语法错误jQuery的animate方法和css3 animation完全是两个不一样的东西,不要混用无论是jQ的animate还是css3的animation网上例子都太多了先去找例子看回答3:http://www.cnblogs.com/WitNesS/p/4643019.html
相关文章:
1. mongodb - windows7下mongod无法正常启动2. MySQL视图count速度优化3. 修改mysql配置文件的默认字符集重启后依然不生效4. android-studio - Android Studio logcat一闪而过,如何显示出来5. mysql中的全文索引支持词根检索吗?6. php - 类似Apple官网顶部3级导航该如何设计数据库?7. mysql - 请教一个Java做数据库缓存的问题8. 请问一下各位老鸟 我一直在学习独孤九贱 现在是在tp5 今天发现 这个系列视频没有实战9. javascript - ueditor引入报错问题10. Python两个list互换,两种不同的操作结果有差异,原因是什么呢?

网公网安备