I have a page that has content that is modified by javascript. I want to create some kind of event listener that triggers when the content’s size changes. I do not want this:
$(window).resize(...);
This triggers when the window size changes – for example when the user re-sizes the browser window. I tried this:
$('body').resize(...);
However it does not trigger. How can I create an event that triggers when the content causes the page size to change? I am also open to plain javascript solutions.
By default jQuery will only let you use that event on
windowbut there is at least one plugin out there that will let you bind it to other elements. I would recommend using that.With this you could then do something similar, like