You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to change the topSpacing value "on-the-fly"? We have a responsive sticky header that changes height during scroll or resize (and at some point disappears completely) and a sidebar that has always the same distance to the header (or the top document border if the header is not visible). If we scroll, the sidebar pans with a spacing (like 50px) from the header that is 100px in height. So the sidebar should be positioned 150px from the top document border. If the header shrinks to 50px, the sidebar should be 100px from the top document. And if the header dissapears completely, the sidebar distance between document top and sidebar should be 50px. Is this possible with your sticky plugin? Can I overwrite the topSpacing value while the script is already running? Or does topSpacing support a dynamic function?
The text was updated successfully, but these errors were encountered:
We had also this issue but in the context of dynamic main content region with top sticky header.
Here is workaround:
// File with content observer callback.constresizedEvent=newCustomEvent("b5Theme.resizeObserver.observeContentRegion",{bubbles: true,detail: {width: rect.width,height: rect.height}});element.target.dispatchEvent(resizedEvent);
// File with sticksy handler.constdefaultBlockPadding=20;letstickyEl=newSticksy('.block-fixed-on-scroll',{topSpacing: defaultBlockPadding});window.addEventListener("b5Theme.resizeObserver.observeContentRegion",e=>{constcontentHeight=e.detail.height;if(sidebar){sidebar.style.height=`${contentHeight}px`;}// In sticksy's minified version there is no "_props" property.constprops=stickyEl?._props??stickyEl?.t??false;if(props){// Fix also sticky block padding when admin toolbar is on the page.constbodyPaddingTop=parseInt(body.style.paddingTop||0);props.topSpacing=bodyPaddingTop+defaultBlockPadding;}stickyEl.hardRefresh();});
Hi
Is it possible to change the topSpacing value "on-the-fly"? We have a responsive sticky header that changes height during scroll or resize (and at some point disappears completely) and a sidebar that has always the same distance to the header (or the top document border if the header is not visible). If we scroll, the sidebar pans with a spacing (like 50px) from the header that is 100px in height. So the sidebar should be positioned 150px from the top document border. If the header shrinks to 50px, the sidebar should be 100px from the top document. And if the header dissapears completely, the sidebar distance between document top and sidebar should be 50px. Is this possible with your sticky plugin? Can I overwrite the topSpacing value while the script is already running? Or does topSpacing support a dynamic function?
The text was updated successfully, but these errors were encountered: