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


As a small performance improvement, might I suggest saving references to $(".corner") and $(window) outside of the scroll function? Otherwise I believe jQuery will perform that selection every time the scroll event fires, which is very unnecessary. So above the scroll function, have something like

var $corner = $(".corner"), $window = $(window);

..and then reference those inside the function.