jQuery 单击替换图像 IE9 Bug

标签 jquery onclick internet-explorer-9

在 IE9 中,只有我有小图像,当用户单击它时,它会在上面的 div 中显示尺寸较大的小图像,以便您可以看到完整图像 - 它适用于除 IE9 之外的所有浏览器,我不知道我还能做些什么来解决这个问题 - 这是一个缓存问题吗? CSS问题?脚本问题?

<script type="text/javascript">
$(document).ready(function () {
    // image swap on the events template
    var $MainLargeImage = $('.control.Event .RightSide .Images .LargeImage');
    var $ThumbnailImages = $('.control.Event .RightSide .Images .smallImages img.SmallImage');

    $ThumbnailImages.click(function () {
        $MainLargeImage.attr('src', $(this).attr('src'));
    });
});
</script>

您可以在此处查看问题:http://team-spirit.co.uk/events/library/A-Taste-Of-Vegas.aspx

最佳答案

你能尝试一下吗,并让我知道 console.log 生成了什么?

$ThumbnailImages.on('click',function () {

    console.log(this);
    var src=$(this).prop('src');
    console.log(src);
    console.log($MainLargeImage.prop('src'));
    $MainLargeImage.prop('src', src);
    console.log($MainLargeImage.prop('src'));

});

关于jQuery 单击替换图像 IE9 Bug,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13194198/

相关文章:

javascript - html 问题 - 按钮超过 anchor ?

java - Android 点击粘贴

javascript - 对于每个项目,item[if].id 不起作用。有任何想法吗?

jquery - 回调函数在 jQuery 中不起作用

javascript - 防止 html 页面在页面加载时自动滚动到小部件

html - 列出的元素将不会显示在 IE 9 中

html - 在 IE9 中作为链接的图片

javascript - vanilla js 替代 jquery 方法来执行安全的 html 解码?

javascript - 无法将 onclick 属性添加到输入可行

jqueryposition() 在 IE9 中不起作用