The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Change Body Border color on Scroll Reply To: Change Body Border color on Scroll


The problem with this system is that it is fragile. Depending on the user’s browser window size and/or resolution of their monitor scrollTop() will have varying results used this way. This even breaks adjusting the height of the view on codepen.

Hmmm…I suspected as much.

Is it possible to get the body height as a an initial variable(?) and then use percentage values instead of fixed pixels.

Eg..After I have scrolled 25% of the way to the bottom I get another color then after 50% yet another and so on?