导致 IE 8 更改为 IE7 兼容模式的代码



我写了一个javascript函数,它将创建一个弹出窗口,我正在从我的代码中调用该函数。但是当我单击按钮时,即更改为ie 7兼容模式,我看到按钮后面的弹出窗口。

这是我的 Java 脚本:

(function(){

jQuery.fn.popbox = function(options){
var settings = jQuery.extend({
selector      : this.selector,
open          : '.open',
box           : '.box',
close         : '.close'
}, options);

var methods = {
open: function(event){
    methods.close();
    jQuery('.collapse').show();
    createpopbox();
event.preventDefault();
//alert("In code");
var pop = jQuery(this);
var box = jQuery(this).parent().find(settings['box']);
//alert(jQuery(this).attr("class"));
var open= jQuery(this).parent().find(settings[jQuery(this).attr("class")]);

if(box.css('display') == 'block'){
methods.close();
} else {
box.css({'display': 'block', 'top': (jQuery(this).position()).top + 12, 'left':(jQuery(this).position()).left  });
}
},
close: function(){
jQuery(settings['box']).hide();//.fadeOut("fast");
removedivs();
}
};

jQuery(document).bind('keyup', function(event){
if(event.keyCode == 27){
methods.close();
}
});

jQuery(document).bind('click', function(event){
if(!jQuery(event.target).closest(settings['selector']).length){
methods.close();
}
});

return this.each(function(){
jQuery(this).css({'width': jQuery(settings['box']).width()}); // Width needs to be set otherwise popbox will not move when window resized.
jQuery(settings['open'], this).bind('click', methods.open);
jQuery(settings['open'], this).parent().find(settings['close']).bind('click', methods.close);
});
};

}).call(this);
    function createpopbox(){
    jQuery('<div class="arrow"></div>'+
'<div class="arrow-border"></div>'
).appendTo('.box');;
    }
    function removedivs(){
    jQuery('form').remove('#subForm');
    jQuery('div').remove('.arrow');
    jQuery('div').remove('.arrow-border');
    }

我尝试添加元标记以强制页面保留在IE 8上,但它不起作用。

谁能帮我摆脱困境?

谢谢

我认为问题不在于代码,浏览器默认使用内部网站的兼容模式

最新更新