ngSticky icon indicating copy to clipboard operation
ngSticky copied to clipboard

When resizing browser window from wide to small with min-width media-query, sticky element does not un-stick

Open HughxDev opened this issue 10 years ago • 5 comments
trafficstars

The style attribute does not change dynamically on window resize. I have to reload the page for it take effect.

HughxDev avatar Aug 22 '15 05:08 HughxDev

I faced the same issue like this :(

tucq88 avatar Jan 26 '16 08:01 tucq88

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

ghost avatar Jan 26 '16 20:01 ghost

@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 :(

tucq88 avatar Jan 27 '16 00:01 tucq88

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.

ghost avatar Mar 23 '16 22:03 ghost

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') };`

tonyfa avatar Oct 03 '16 13:10 tonyfa