pull/36/head
sentsin 2016-11-07 09:02:31 +08:00
parent 20c6d29d3f
commit 943169f38a
1 changed files with 26 additions and 19 deletions

View File

@ -27,7 +27,12 @@ var isLayui = window.layui && layui.define, $, win, ready = {
//默认内置方法。
var layer = {
v: '3.0',
ie6: !!window.ActiveXObject&&!window.XMLHttpRequest,
ie: function(){ //ie版本
var agent = navigator.userAgent.toLowerCase();
return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
(agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识
) : false;
}(),
index: (window.layer && window.layer.v) ? 100000 : 0,
path: ready.getPath,
config: function(options, fn){
@ -295,7 +300,7 @@ Class.pt.creat = function(){
config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times);
}).auto(times);
config.type == 2 && layer.ie6 && that.layero.find('iframe').attr('src', content[0]);
config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]);
//坐标自适应浏览器窗口尺寸
config.type == 4 ? that.tips() : that.offset();
@ -323,7 +328,7 @@ Class.pt.auto = function(index){
var that = this, config = that.config, layero = $('#'+ doms[0] + index);
if(config.area[0] === '' && config.maxWidth > 0){
//为了修复IE7下一个让人难以理解的bug
if(/MSIE 7/.test(navigator.userAgent) && config.btn){
if(layer.ie && layer.ie < 8 && config.btn){
layero.width(layero.innerWidth());
}
layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth);
@ -518,7 +523,9 @@ Class.pt.move = function(){
//拖拽移动
if(dict.moveStart){
var X = e.clientX - dict.offset[0]
,Y = e.clientY - dict.offset[1]
,Y = e.clientY - dict.offset[1];
e.preventDefault();
dict.stX = config.fixed ? 0 : win.scrollLeft();
dict.stY = config.fixed ? 0 : win.scrollTop();
@ -537,20 +544,20 @@ Class.pt.move = function(){
left: X
,top: Y
});
return false;
}
//Resize
if(config.resize && dict.resizeStart){
var X = e.clientX - dict.offset[0]
,Y = e.clientY - dict.offset[1]
,Y = e.clientY - dict.offset[1];
e.preventDefault();
layer.style(that.index, {
width: dict.area[0] + X
,height: dict.area[1] + Y
})
dict.isResize = true;
return false;
}
}).on('mouseup', function(e){
if(dict.moveStart){
@ -579,7 +586,7 @@ Class.pt.callback = function(){
config.success(layero, that.index);
}
}
layer.ie6 && that.IE6(layero);
layer.ie == 6 && that.IE6(layero);
//按钮
layero.find('.'+ doms[6]).children('a').on('click', function(){
@ -876,7 +883,7 @@ layer.close = function(index){
};
layero.addClass(closeAnim);
$('#layui-layer-moves, #layui-layer-shade' + index).remove();
layer.ie6 && ready.reselect();
layer.ie == 6 && ready.reselect();
ready.rescollbar(index);
typeof ready.end[index] === 'function' && ready.end[index]();
delete ready.end[index];
@ -886,7 +893,7 @@ layer.close = function(index){
}
setTimeout(function(){
remove();
}, 200);
}, (layer.ie && layer.ie < 10) ? 0 : 200);
};
//关闭所有层