jquery自定义动画
程序员文章站
2022-07-13 08:41:00
...
使用jquery实现自定义动画方法
使用animate 实现动画
css样式
//定义图片属性 img{position:relative;}//定位
代码
$(function () { // $("img").hover(function () { // // $(this).animate({left:"+=2px"},200).animate({left:"-=2px"},200); // // }, function () { // // }); $("img").click(function () { $(this).animate({left:"+=3px"},200).animate({left:"-=3px"},200); }); });
html代码
<img src="xxxx.jpg">
上一篇: ES6 Class类、模块 (四)
下一篇: 【动画工具】animate.css