|
应该跟以下两段代码有关:
\static\js\mobile\common.js 第 546-600 行:
- var POPMENU = new Object;
- var popup = {
- init : function() {
- var $this = this;
- $('.popup').each(function(index, obj) {
- obj = $(obj);
- var pop = $(obj.attr('href'));
- if(pop && pop.attr('popup')) {
- pop.css({'display':'none'});
- obj.on('click', function(e) {
- $this.open(pop);
- });
- }
- });
- this.maskinit();
- },
- maskinit : function() {
- var $this = this;
- $('#mask').off().on('tap', function() {
- $this.close();
- });
- },
- open : function(pop, type, url) {
- this.close();
- this.maskinit();
- if(typeof pop == 'string') {
- $('#ntcmsg').remove();
- if(type == 'alert') {
- pop = '<div class="tip"><dt>'+ pop +'</dt><dd><input class="button2" type="button" value="确定" onclick="popup.close();"></dd></div>'
- } else if(type == 'confirm') {
- pop = '<div class="tip"><dt>'+ pop +'</dt><dd><input class="redirect button2" type="button" value="确定" href="'+ url +'"><a href="javascript:;" onclick="popup.close();">取消</a></dd></div>'
- }
- $('body').append('<div id="ntcmsg" style="display:none;">'+ pop +'</div>');
- pop = $('#ntcmsg');
- }
- if(POPMENU[pop.attr('id')]) {
- $('#' + pop.attr('id') + '_popmenu').html(pop.html()).css({'height':pop.height()+'px', 'width':pop.width()+'px'});
- } else {
- pop.parent().append('<div class="dialogbox" id="'+ pop.attr('id') +'_popmenu" style="height:'+ pop.height() +'px;width:'+ pop.width() +'px;">'+ pop.html() +'</div>');
- }
- var popupobj = $('#' + pop.attr('id') + '_popmenu');
- var left = (window.innerWidth - popupobj.width()) / 2;
- var top = (document.documentElement.clientHeight - popupobj.height()) / 2;
- popupobj.css({'display':'block','position':'fixed','left':left,'top':top,'z-index':120,'opacity':1});
- $('#mask').css({'display':'block','width':'100%','height':'100%','position':'fixed','top':'0','left':'0','background':'black','opacity':'0.2','z-index':'100'});
- POPMENU[pop.attr('id')] = pop;
- },
- close : function() {
- $('#mask').css('display', 'none');
- $.each(POPMENU, function(index, obj) {
- $('#' + index + '_popmenu').css('display','none');
- });
- }
- };
复制代码
第 663-700 行:
- var DISMENU = new Object;
- var display = {
- init : function() {
- var $this = this;
- $('.display').each(function(index, obj) {
- obj = $(obj);
- var dis = $(obj.attr('href'));
- if(dis && dis.attr('display')) {
- dis.css({'display':'none'});
- dis.css({'z-index':'102'});
- DISMENU[dis.attr('id')] = dis;
- obj.on('click', function(e) {
- if(in_array(e.target.tagName, ['A', 'IMG', 'INPUT'])) return;
- $this.maskinit();
- if(dis.attr('display') == 'true') {
- dis.css('display', 'block');
- dis.attr('display', 'false');
- $('#mask').css({'display':'block','width':'100%','height':'100%','position':'fixed','top':'0','left':'0','background':'transparent','z-index':'100'});
- }
- return false;
- });
- }
- });
- },
- maskinit : function() {
- var $this = this;
- $('#mask').off().on('touchstart', function() {
- $this.hide();
- });
- },
- hide : function() {
- $('#mask').css('display', 'none');
- $.each(DISMENU, function(index, obj) {
- obj.css('display', 'none');
- obj.attr('display', 'true');
- });
- }
- };
复制代码 |
|