使用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);
});
});<img src="xxxx.jpg">
原文:http://blog.csdn.net/itlqi/article/details/42077217