ngSticky
ngSticky copied to clipboard
When resizing browser window from wide to small with min-width media-query, sticky element does not un-stick
The style attribute does not change dynamically on window resize. I have to reload the page for it take effect.
I faced the same issue like this :(
To fix that, i made the page reload when its going from query to query (768 to 769) with location reload or route reload for angular.
No other fixes in mind yet
@Admsol yeah that fix does the trick, but it would be annoying if you rotate the tablet then it refresh, I'm still working out to find another solution for this :( Another problem I faced is similar to this is when I using mdDialog by Angular Material, because they change the body style so after dialog opened - the sticky will remain stuck and never un-stuck until page reload. :( It seems like un-stick get problem with window resizing and body styling :(
I have a similar issue but it's happening when I show an Angular Material dialog. One fix I have is to scroll to the top before showing the dialog but this is not ideal.
None of the above worked so I did this
`var widthT = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
return { zIndex: $elem.css('z-index'), top: $elem.css('top'), position: initialPosition, // revert to true initial state marginTop: $elem.css('margin-top'), marginBottom: $elem.css('margin-bottom'), cssLeft: getCSS($elem, 'left'), //width: ($elem[0].style && $elem[0].style.width) || $elem[0].offsetWidth, width: widthT, height: $elem.css('height') };`