gpt4 book ai didi

javascript - 飞到购物车效果 - 通用图像

转载 作者:行者123 更新时间:2023-11-30 05:35:16 25 4
gpt4 key购买 nike

试过到处搜索但找不到解决方案,所以就这样吧。

基于以下脚本 - 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com