layer.popup.prototype.create = function(){ var self = this, id = 'nj_popup_' + (+new Date); layer.popup.item[id] = this; this.key = id; this.set('content', [ '<span class="win_close nj_ico n_i_close">×</span><div class="win_tit"></div>', '<div class="win_con clearfix"></div>', '<div class="win_opt"></div>' ].join('')); this.content.addClass('win_wrap'); if( this.options.fullScreen ){//全屏 this.element.css( {'width':'100%','height':'100%'} ); this.position = {top:0,left:0} this.element.addClass('full_pop'); this.layer = null; }else{ this.element.css( {'width':this.options.width} ); } this.element[0].id = id; this.close = this.element.find(".win_close"); this.title = this.element.find(".win_tit").hide(); this.content = this.element.find(".win_con"); this.operating = this.element.find(".win_opt").hide(); this.close.on(ui.config.clickEvent, function(){//绑定关闭按钮事件 self.hide(); }); this.bindEsc && !layer.popup.bind.init && layer.popup.bind(); $.onScroll( this.element[0] ); }
function init(){ layer = $('<div id="nj_layer" class="nj_layer"></div>').appendTo(document.body); if( $.browser.ie && parseInt($.browser.version)==6 ){ S = function(){ layer.css({ width : w.width(), height : w.height() }); }; S(); w.on('scroll resize', S); new ui.align({ element : layer }); } $.onScroll( layer[0] ); arr.element = layer; effect = new ui.effect(layer); };