[英]code causing the IE 8 to change to IE7 compatibilty mode
我写了一个javascript函数,它将创建一个弹出窗口,我从代码中调用该函数。但是,每当我单击按钮即更改为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');
}
我已经尝试添加meta标签来强制页面停留在即8上,但是它不起作用。
有人可以帮我吗?
谢谢
我认为问题不在代码中,对于Intranet网站,浏览器默认使用兼容模式
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.