0

I'm using a PolyCalc to polyfill CSS calc(). I need to run it whenever window size changes, but resize event seems not to be fired when scrollbars appear. And scrollbars appear with some delay on my page as some of the content is loaded from a server.

Nux
  • 9,276
  • 5
  • 59
  • 72
  • if you included code, those who're not necessarily absolutely familiar with your question and the plugin may also be able to help, this way you limit yourself to experts of PolyCalc only... with this amount of points you should know better... – benomatis Apr 28 '14 at 16:40
  • 4
    This may be useful: http://stackoverflow.com/questions/2578046/scrollbar-appear-disappear-event-in-jquery – Tricky12 Apr 28 '14 at 16:40
  • @webeno The question is more general and is about a window/document event that would be fired when scrollbars appear. But you can find [PolyCalc on github](https://github.com/Eccenux/PolyCalc). – Nux Apr 28 '14 at 18:31
  • @Tricky12, thanks. Based on that I guess the answer to my question is "No", but I'll wait to see if anyone come up with an answer. – Nux Apr 28 '14 at 18:33
  • Could you just check at a certain interval for particular things that might have a scrollHeight exceeding their height and resize or whatever accordingly? – tuespetre Apr 28 '14 at 18:38
  • @tuespetre I wanted more immediate reaction, but I guess I'll have to settle for hacking ;-). – Nux Apr 29 '14 at 10:27
  • Read this article, it's the only one on the internet which actually knows of what he's talking about - http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/ – vsync Apr 29 '14 at 10:38

1 Answers1

0

I guess I have to answer my own question. Thanks to @Tricky12 I know it is not likely that there is more elegant solution then checking for resize at some interval.

Anyway I found a jQuery resize plugin that does that and allows to check for resize on any element and also replaces default $(window).resize which then reacts on scrollbars.

Nux
  • 9,276
  • 5
  • 59
  • 72
  • it's from 4 years ago, and I HARDLY believe it actually works. – vsync Apr 29 '14 at 10:37
  • I haven't tested on elements but from what I seen in code the concept is simple - it adds elements to internal array and then just loops to check for their size. Whenever their size change it fires resize event. It seems to be immune to display changes of elements and doesn't add any extra elements to DOM. – Nux Apr 29 '14 at 10:55
  • 1
    so simple? just hammers the cpu and loops on all elements in an interval to check their dimensions? sounds like big no-no to me..why would you want a script that does something like that? – vsync Apr 29 '14 at 11:35