Forcing garbage collection in Google Chrome

You can fetch code of Chrome Dev Tools, modify it so that ProfilerAgent.collectGarbage(); is called every now and then (it’s a code that is called when you click ‘Collect Garbage’ button on the Timeline panel) and run Chrome with your version of DevTools using –debug-devtools-frontend flag. However, this solution is quite extreme, try it only … Read more

How to check if an element is off-screen

Depends on what your definition of “offscreen” is. Is that within the viewport, or within the defined boundaries of your page? Using Element.getBoundingClientRect() you can easily detect whether or not your element is within the boundries of your viewport (i.e. onscreen or offscreen): jQuery.expr.filters.offscreen = function(el) { var rect = el.getBoundingClientRect(); return ( (rect.x + … Read more