jQuery代码飞到购物车$(".add-to-cart").click(function() { var cart = $(".shopping_bg"); var imgtofly = $(this).parents("li.cart_items").find("a.product-image img").eq(0); if (imgtofly) { var imgclone = imgtofly.clone() .offset({ top:imgtofly.offset().top, left:imgtofly.offset().left }) .css({"opacity":"0.7", "position":"absolute", "height":"150px", "width":"150px", "z-index":"1000"}) .appendTo($("body")) .animate({ "top":cart.offset().top + 10, "left":cart.offset().left + 30, "width":55, "height":55 }, 1000, "easeInElastic"); imgclone.animate({"width":0, "height":0}, function(){ $(this).detach() }); } return false;});使用easeInElastic移动动画效果。您可以修改这个动画基于您的需要。

dd:
该博客介绍了如何利用jQuery创建一个商品图片飞入购物车的动画效果,通过克隆图片元素并调整其位置和大小,实现平滑的动画过渡。动画效果采用了easeInElastic,可以依据需求进行自定义修改。
2634

被折叠的 条评论
为什么被折叠?



