You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
1.2 KiB
1 lines
1.2 KiB
YUI.add("moodle-core-lockscroll",function(e,t){e.namespace("M.core").LockScroll=e.Base.create("lockScroll",e.Plugin.Base,[],{_enabled:!1,destructor:function(){this.disableScrollLock()},enableScrollLock:function(t){if(this.isActive())return;if(!this.shouldLockScroll(t))return;this._enabled=!0;var n=e.one(e.config.doc.body),r=n.getComputedStyle("width");n.addClass("lockscroll");var i=parseInt(n.getAttribute("data-activeScrollLocks"),10)||0,s=i+1;return n.setAttribute("data-activeScrollLocks",s),i===0&&n.setStyle("maxWidth",r),this},shouldLockScroll:function(t){var n=this.get("host").get("boundingBox").get("region").height,r=e.config.win.innerHeight||e.config.doc.documentElement.clientHeight||0;return!t&&n>r-10?!1:!0},updateScrollLock:function(e){return this.shouldLockScroll(e)?this.enableScrollLock(e):this.disableScrollLock(!0),this},disableScrollLock:function(t){if(this.isActive()){this._enabled=!1;var n=e.one(e.config.doc.body),r=parseInt(n.getAttribute("data-activeScrollLocks"),10)||1,i=r-1;if(t||r===1)n.removeClass("lockscroll"),n.setStyle("maxWidth",null);n.setAttribute("data-activeScrollLocks",r-1)}return this},isActive:function(){return this._enabled}},{NS:"lockScroll",ATTRS:{}})},"@VERSION@",{requires:["plugin","base-build"]});
|
|
|