gpt4 book ai didi

javascript - JQuery 替换的链接在 IE 8-10 下不起作用

转载 作者:行者123 更新时间:2023-11-28 10:46:22 25 4
gpt4 key购买 nike

我制作了一个弹出窗口,但 IE 8-10 有问题(在 IE11 下没问题)。我的代码将图像替换为链接图像。链接在 Firefox、Chrome 和 IE11 下工作,但在其他 IE 版本下不工作。默认情况下这是一个弹出窗口。这是我的代码:

<div id="fadeinboxrevol">
<div id="koppbase">
<p class="kalapacs"><img src="./images/original.png" alt="Click here" /></p>
</div>
</div>
<script type="text/javascript">
var tto = jQuery.noConflict();
function get_path() {
var piclist =['./images/1.png','./images/2.png','./images/3.png','./images/4.png'];
var linklist =['1.html','2.html','3.html','4.html'];
var random = Math.floor(Math.random()*piclist.length);
var picpath = piclist[random];
var linkpath = linklist[random];
var pack = [picpath, linkpath];

return pack;
}

tto(".kalapacs").click(function () {
var mypack = get_path();
var mypic = mypack[0];
var mypath = mypack[1];

var content1 = '<p class="torp"><img class="torve" src="'+mypic+'" alt="Don't wait" /><a class="tortext" href="'+mypath+'"></a></p>';

tto("#koppbase").html(content1);

});

</script>

这是我的 CSS:

#fadeinboxrevol {
position: absolute;
width: auto;
left: 301px;
top: 262.5px;
visibility: visible;
border: none;
background-color: ;
padding: 0 px;
z-index: 999;
text-align: left;
}
.kalapacs:hover {
cursor: url(http://cur.cursors-4u.net/others/oth-5/oth438.cur), progress !important;
}
.torp {
position: relative;
}
.tortext {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
display: block;
z-index: 9999;
}
#revolclosebutton {
margin-top: -40px;
right: 20px;
position: absolute;
width: 16px;
z-index: 999;
}

这是jsfiddle中的一个例子,为了更好的兼容性,我使用jQuery 1.11版本: http://jsfiddle.net/mykee/uDCKL/

我也试过这条线:

tto("#koppbase").replaceWith(content1);

但没有帮助。 :-(

我的问题是什么?

最佳答案

问题是这行代码:var content1 = '<p class="torp"><img class="torve" src="'+mypic+'" alt="Don't wait" /><a class="tortext" href="'+mypath+'"></a></p>';

将其更改为: var content1 = '<p class="torp"><a class="tortext" href="'+mypath+'"><img class="torve" src="'+mypic+'" alt="Don't wait" /></a></p>';

当你看旧的 IE 时,img 标签后面的 a 是空的,所以很难点击它! (将鼠标悬停在第二张图片上。)

演示: http://jsfiddle.net/uDCKL/7/

关于javascript - JQuery 替换的链接在 IE 8-10 下不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22968951/

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