作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
试过到处搜索但找不到解决方案,所以就这样吧。
基于以下脚本 - http://codepen.io/ElmahdiMahmoud/pen/tEeDn
与其让图像在页面上呈现以飞向篮子,不如我如何用通用图像覆盖它,例如:http://lorempixel.com/400/200/ ---- 我将使用的路径是图像文件夹。
最佳答案
我从这里找到了 jQuery 飞到购物车效果的最佳解决方案 - Fly to cart effect using jQuery该脚本的使用非常简单,如下所示。
$(document).ready(function(){
$('.add-to-cart').on('click',function(){
//Scroll to top if cart icon is hidden on top
$('html, body').animate({
'scrollTop' : $(".cart_anchor").position().top
});
//Select item image and pass to the function
var itemImg = $(this).parent().find('img').eq(0);
flyToElement($(itemImg), $('.cart_anchor'));
});
});
关于javascript - 飞到购物车效果 - 通用图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24158419/
我是一名优秀的程序员,十分优秀!