彈窗 (居中 滾動)
阿新 • • 發佈:2019-02-19
var $ = require('common:ui/jquery');
function domCenter(opt){
this.options = $.extend({
dom:"",
height: 0,
domCss:{},
domchange:{},
foot:false,
head:false
}, opt || {});
this.init();
}
domCenter.prototype = {
config:{
wH : $(window).height()
},
init: function(){
this.bindEvent();
},
bindEvent:function(){
var that = this;
that.onload();
$(window).resize(function(){
that.config.wH = $(window).height();
that.onload();
})
},
onload: function(){
var that = this;
var oH = $(that.options.dom).height() + 150;
if(that.config.wH < oH + that.options.height){
if(!that.options.head){
$('.aaz_header').css("position","relative");
}
if(!that.options.foot){
$('.aaz_footer').css("position","relative");
}
$(that.options.dom).css(that.options.domCss);
}else{
if(!that.options.head){
$('.aaz_header').css("position","absolute");
}
if(!that.options.foot){
$('.aaz_footer').css("position","absolute");
}
$(that.options.dom).css(that.options.domchange);
}
}
};
return domCenter;
function domCenter(opt){
this.options = $.extend({
dom:"",
height: 0,
domCss:{},
domchange:{},
foot:false,
head:false
}, opt || {});
this.init();
}
domCenter.prototype = {
config:{
wH : $(window).height()
},
init: function(){
this.bindEvent();
},
bindEvent:function(){
var that = this;
that.onload();
$(window).resize(function(){
that.config.wH = $(window).height();
that.onload();
})
},
onload: function(){
var that = this;
var oH = $(that.options.dom).height() + 150;
if(that.config.wH < oH + that.options.height){
if(!that.options.head){
$('.aaz_header').css("position","relative");
}
if(!that.options.foot){
$('.aaz_footer').css("position","relative");
}
$(that.options.dom).css(that.options.domCss);
}else{
if(!that.options.head){
$('.aaz_header').css("position","absolute");
}
if(!that.options.foot){
$('.aaz_footer').css("position","absolute");
}
$(that.options.dom).css(that.options.domchange);
}
}
};
return domCenter;