Difference between revisions of "Template:Washington"

Line 401: Line 401:
 
     } // this for loop fills the aArray with attribute href values
 
     } // this for loop fills the aArray with attribute href values
  
    $(window).scroll(function(){
 
        var windowPos = $(window).scrollTop(); // get the offset of the window from the top of page
 
        var windowHeight = $(window).height(); // get the height of the window
 
        var docHeight = $(document).height();
 
  
        for (var i=0; i < aArray.length; i++) {
 
            var theID = aArray[i];
 
            var divPos = $(theID).offset().top; // get the offset of the div from the top of page
 
            var divHeight = $(theID).height(); // get the height of the div in question
 
            if (windowPos >= divPos && windowPos < (divPos + divHeight)) {
 
                $("a[href='" + theID + "']").addClass("nav-active");
 
            } else {
 
                $("a[href='" + theID + "']").removeClass("nav-active");
 
            }
 
        }
 
  
 
         if(windowPos + windowHeight == docHeight) {
 
         if(windowPos + windowHeight == docHeight) {

Revision as of 23:18, 13 September 2015