禁止页面滚动

  /**
         * (展示遮罩层时)阻止页面滚动
         * @method disableScroll
         * @chainable
         */
        disableScroll: function() {
            docElem.detach('touchmove', this._preventScroll);
            docElem.on('touchmove', this._preventScroll);
            
            if (isHuaweiP6) {
                docElem.addClass('m-mask-disable-scroll');
                bodyElem.addClass('m-mask-disable-scroll');
            }
            
            docElem.addClass('m-mask-disabled');
            
            return this;
        },
        
        /**
         * (关闭遮罩层时)恢复页面滚动
         * @method enableScroll
         * @chainable
         */
        enableScroll: function() {
            docElem.detach('touchmove', this._preventScroll);
            
            if (isHuaweiP6) {
                docElem.removeClass('m-mask-disable-scroll');
                bodyElem.removeClass('m-mask-disable-scroll');
            }
            
            docElem.removeClass('m-mask-disabled');
            
            return this;
        },


 /**
         * 阻止页面滚动回调
         * @method _preventScroll
         * @param {EventFacade} e 事件对象
         * @protected
         */
        _preventScroll: function(e) {
            e.preventDefault();
        },
        

 

posted on 2016-03-11 11:58  dhj  阅读(306)  评论(0编辑  收藏  举报

导航