Forums

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

Home Forums Other Jquary navbar change when section (DIV) is view-able in window Reply To: Jquary navbar change when section (DIV) is view-able in window

#267909
Shikkediel
Participant

From a first glance at the top bit of code, .css doesn’t do anything and should give a error:

$('.header').css.offset().top;

This is the correct format:

$('.header').offset().top;

The code at the bottom won’t work because of if else – that should say else if

Edit – multiple errors here as well:

if (scrollPos >= top1 && scrollPos = top2 && scrollPos = top3) {

This condition won’t ever be true unless top2 and top3 have the same value. Besides that, comparison syntax is different:

if (scrollPos >= top1 && scrollPos == top2 && scrollPos == top3) {

Some purists would suggest to even use scrollPos === top2.