Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using javascript or jQuery, how I can detect unused "whitespace" screen realestate?

Tags:

javascript

For example, stackoverflow website is centered with 'whitespace' filling the width of my 1920x1200 screen. I'm trying to find javascript or jQuery code to detect where available whitespace is on any website and fill it or overlay with an image or div. Is that even possible ?

like image 318
Justin Avatar asked Jul 22 '11 03:07

Justin


1 Answers

This would be extremely hard to do. You would be hard pressed to do it reliably in a way that would work on any website, even websites you don't control.

What you could do is walk the whole DOM and figure out the rectangle that each visible element takes up - but then how do you define visible? Sometimes what you see as whitespace is a div with a white background which is on top of some other div, sometimes you're seeing the bare body element, sometimes it's slightly off-white, or a different color, etc.

like image 78
thomasrutter Avatar answered Oct 18 '22 14:10

thomasrutter