@claspo/document-connector 16.8.0 → 16.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
class GlobalScrollBlocker{static block(){this.activeBlockersCount++;const l=document.documentElement;if(this.activeBlockersCount>1||l.scrollHeight<=l.clientHeight)return;const o=window.scrollY,t=window.scrollX,e=l.style;this.savedParams={scrollTopPosition:o,scrollLeftPosition:t,htmlElemTop:e.top||"",htmlElemLeft:e.left||"",htmlElemPosition:e.position||"",htmlElemWidth:e.width||"",htmlElemHeight:e.height||"",htmlElemOverflowY:e.overflowY||""},e.top=-o+"px",e.left=-t+"px",e.position="fixed",e.width="100%",e.height="auto",e.overflowY="scroll",l.classList.add(GlobalScrollBlocker.globalScrollBlockClass)}static restore(){if(0===this.activeBlockersCount)return;if(this.activeBlockersCount--,this.activeBlockersCount>0||!this.savedParams)return;const l=this.savedParams;this.savedParams=null;const o=document.documentElement,t=document.body,e=o.style,s=t.style,c=e.scrollBehavior||"",r=s.scrollBehavior||"";e.top=l.htmlElemTop,e.left=l.htmlElemLeft,e.position=l.htmlElemPosition,e.width=l.htmlElemWidth,e.height=l.htmlElemHeight,e.overflowY=l.htmlElemOverflowY,o.classList.remove(GlobalScrollBlocker.globalScrollBlockClass),e.scrollBehavior=s.scrollBehavior="auto",
|
|
1
|
+
class GlobalScrollBlocker{static block(){this.activeBlockersCount++;const l=document.documentElement;if(this.activeBlockersCount>1||l.scrollHeight<=l.clientHeight)return;const o=window.scrollY,t=window.scrollX,e=l.style;this.savedParams={scrollTopPosition:o,scrollLeftPosition:t,htmlElemTop:e.top||"",htmlElemLeft:e.left||"",htmlElemPosition:e.position||"",htmlElemWidth:e.width||"",htmlElemHeight:e.height||"",htmlElemOverflowY:e.overflowY||""},e.top=-o+"px",e.left=-t+"px",e.position="fixed",e.width="100%",e.height="auto",e.overflowY="scroll",l.classList.add(GlobalScrollBlocker.globalScrollBlockClass)}static restore(){if(0===this.activeBlockersCount)return;if(this.activeBlockersCount--,this.activeBlockersCount>0||!this.savedParams)return;const l=this.savedParams;this.savedParams=null;const o=document.documentElement,t=document.body,e=o.style,s=t.style,c=e.scrollBehavior||"",r=s.scrollBehavior||"";e.top=l.htmlElemTop,e.left=l.htmlElemLeft,e.position=l.htmlElemPosition,e.width=l.htmlElemWidth,e.height=l.htmlElemHeight,e.overflowY=l.htmlElemOverflowY,o.classList.remove(GlobalScrollBlocker.globalScrollBlockClass),e.scrollBehavior=s.scrollBehavior="auto",GlobalScrollBlocker.scrollWindowTo(l.scrollLeftPosition,l.scrollTopPosition),e.scrollBehavior=c,s.scrollBehavior=r}static scrollWindowTo(l,o){if("function"==typeof window.scroll)return void window.scroll(l,o);if("function"==typeof window.scrollTo)return void window.scrollTo(l,o);const t=document.documentElement;t.scrollTop=o,t.scrollLeft=l}}GlobalScrollBlocker.globalScrollBlockClass="cl-global-scroll-block",GlobalScrollBlocker.activeBlockersCount=0,GlobalScrollBlocker.savedParams=null;export default GlobalScrollBlocker;
|