gpt4 book ai didi

javascript - jquery 脚本在 ie 中不起作用

转载 作者:行者123 更新时间:2023-12-02 20:26:20 24 4
gpt4 key购买 nike

当我点击缩略图时,这个脚本会更改大图片的链接和图像路径,它在所有浏览器中都可以正常工作,除了)IE

    $('.image').click(function(event) {
event.preventDefault();
var imagePath = $(this).attr("href");
var newImg = new Image;
newImg.src = imagePath;
newImg.onload = function(){
$('#big_picture2').hide();
$('#big_picture2').attr('src', imagePath);
$('.product_image_large').attr('href', imagePath);
$('#big_picture2').fadeIn('slow');
};
});

html 看起来像这样:

<a href="/documents/product/#GET_IMAGE_BIG.path#" id="thumb1" onclick="return hs.expand(this, { slideshowGroup: 1 } )" class="product_image_large"><img src="/documents/product/#path#" id="big_picture2" border="0" /></a>

<a href="/documents/product/#get_product_images.path#" class="image"><cf_get_server_file output_file="product/#get_product_images.path#" title="#get_product_images.detail#" output_server="#path_server_id#" output_type="0" image_width="45" image_height="41"></a>

不要被 cf_get_server_file 打扰,这只是动态冷聚变代码,它工作得很好。

最佳答案

不确定这是否能解决整个问题,但您在定义 src 属性后设置 onload 事件。这就是自找麻烦。反过来做。

关于javascript - jquery 脚本在 ie 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4794698/

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