Hi again,
It looks like the one page navigation setup issue make sure you’ve activated and selected a menu in Cornerstone’s One Page Navigation setting but remove the custom code first provided earlier. If this doesn’t resolve the issue then replace the previous code with the following:
jQuery(document).ready(function($) {
/**
* This part handles the highlighting functionality.
* We use the scroll functionality again, some array creation and
* manipulation, class adding and class removing, and conditional testing
*/
var aChildren = $("nav li").children(); // find the a children of the list items
var aArray = []; // create the empty aArray
for (var i=0; i < aChildren.length; i++) {
var aChild = aChildren[i];
var ahref = $(aChild).attr('href');
aArray.push(ahref);
//alert(ahref);
} // 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
divPos = divPos - 135; // fix for header hight and padding. In our case 90px+45px
var divHeight = $(theID).height(); // get the height of the div in question
divHeight = divHeight +90;// correction for our previous fix so that end of div is calculated properly. This is height of fixed header
if (windowPos >= divPos && windowPos < (divPos + divHeight)) {
$("a[href='" + theID + "']").parent().addClass("current-menu-item");
} else {
$("a[href='" + theID + "']").parent().removeClass("current-menu-item");
}
}
});
});
Let us know how this goes!