gpt4 book ai didi

jQuery 函数 .bind 在 IE 中不起作用

转载 作者:搜寻专家 更新时间:2023-10-31 08:07:59 24 4
gpt4 key购买 nike

This is my website

如果您单击小缩略图,则会显示较大的图像。在 Chrome 中它工作得很好,但是当我在 IE9 中尝试它时它什么也没做。这是我的代码:

jQuery

// JavaScript Document

//Button1
;(function($) {

// DOM Ready
$(function() {

// Binding a click event
// From jQuery v.1.7.0 use .on() instead of .bind()
$('#my-button').bind('click', function(e) {

// Prevents the default action to be triggered.
e.preventDefault();

// Triggering bPopup when click event is fired
$('#element_to_pop_up').bPopup({
appendTo: 'form'
, zIndex: 2
, modalClose: false
});
});
});
})(jQuery);
//Button2



;(function($) {

// DOM Ready
$(function() {

// Binding a click event
// From jQuery v.1.7.0 use .on() instead of .bind()
$('#my-button1').bind('click', function(e) {

// Prevents the default action to be triggered.
e.preventDefault();

// Triggering bPopup when click event is fired
$('#element_to_pop_up1').bPopup({
appendTo: 'form'
, zIndex: 2
, modalClose: true
});
});
});
})(jQuery);


;(function($) {
//Button3


// DOM Ready
$(function() {

// Binding a click event
// From jQuery v.1.7.0 use .on() instead of .bind()
$('#my-button2').bind('click', function(e) {

// Prevents the default action to be triggered.
e.preventDefault();

// Triggering bPopup when click event is fired
$('#element_to_pop_up2').bPopup({
appendTo: 'form'
, zIndex: 2
, modalClose: false
});
});
});
})(jQuery);

还有我的 HTML

<!-- Portfolio Popup Box -->

<div id="element_to_pop_up">
<a class="bClose">x<a/>
<img src="imgs/portfolio/bobbie.png" width="100%" height="100%" alt="Bobbie Gordon Website" />
</div>

<div id="element_to_pop_up1">
<a class="bClose">x<a/>
<img src="imgs/portfolio/jareth.png" width="100%" height="100%" alt="Bobbie Gordon Website" />
</div>

<div id="element_to_pop_up2">
<a class="bClose">x<a/>
</div>

<!-- Portfolio Popup Box End -->

CSS

#element_to_pop_up { 
padding:5px;
color:#000;
display:none;
width:90%;
height: 100%;
position:absolute;
border:1px solid #000;
}
#element_to_pop_up1 {
padding:5px;
color:#000;
display:none;
width:90%;
height: 90%;
position:absolute;
}
#element_to_pop_up2 {
padding:5px;
color:#000;
display:none;
width:90%;
height: 90%;
position:absolute;
}

.bClose{
cursor:pointer;
position:absolute;
right:-15px;
top:-15px;
font-size:22px;
font-weight:bold;
}

我很确定这与绑定(bind) onclick 有关。也许IE不认识它?或者只是在您单击它时立即取消,从而产生什么都没有发生的效果。

谢谢大家。

感谢 Sparky,现在这个问题已经解决了!

最佳答案

将您的 .bind() 转换为 .on()或者降级你的 jQuery 版本。您的网站正在运行 jQuery 1.9 which has removed nearly all deprecated features .您还可以包括 migrate plugin .

此外,要想让站点在资源管理器中正常运行,您必须首先验证 HTML:

http://validator.w3.org/check?uri=http%3A%2F%2Fjohns-webdesign.com%2Fport.html&charset=%28detect+automatically%29&doctype=Inline&group=0

关于jQuery 函数 .bind 在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14860018/

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