UNPKG

fd-gulp-convert-encoding

Version:

convert file to assigned charset

81 lines (64 loc) 1.96 kB
/** * gallery view交互逻辑 */ define('detail.modules.preferential.View', ['jQuery', 'Class', 'lofty.ui.Popup', 'detail.core.Event'], function($, Class, Popup, Event) { return Class({ init: function(view, config) { this.onEvent = $.os.supportsTouch ? 'tap' : 'click'; this.div = view; // this._bindEvent(); this.descShowUp(); }, _bindEvent: function(){ var that = this; Event.on('back', function(){ if (that.openFlag) { Event.trigger('closePreferentialDialog'); return false; } }); }, descShowUp: function(){ var that = this, popup = new Popup({ tpl: '.d-dialog-preferential', isModal: true, maskAttr: { maskOpacity: '.8' }, buttons: [ { 'event': that.onEvent, 'selector': '.d-close', 'callback': function(popup, paramObj){ this.hide(); that.openFlag = false; that.showBodyOverflow(); } } ] }); Event.on('closePreferentialDialog', function(){ popup.hide(); }); $('a.d-close').on('click', function(e){ e.preventDefault(); }); this.div.on(this.onEvent, function(e){ e.preventDefault(); popup.show(); that.openFlag = true; that.hideBodyOverflow(); }); }, hideBodyOverflow: function(){ this.bodyOverflow = $('body').css('overflow'); $('body').css('overflow','hidden'); }, showBodyOverflow: function(){ $('body').css('overflow', this.bodyOverflow); } }); });