diff --git a/jquery.nav.js b/jquery.nav.js index abc74ba..ff596b0 100644 --- a/jquery.nav.js +++ b/jquery.nav.js @@ -131,7 +131,7 @@ var windowHeight = Math.round(this.$win.height() * this.config.scrollThreshold); for(var section in this.sections) { - if((this.sections[section] - windowHeight) < windowPos) { + if((this.sections[section] - windowHeight) < windowPos && (returnValue == null || this.sections[section] > this.sections[returnValue])) { returnValue = section; } } @@ -220,4 +220,4 @@ }); }; -})( jQuery, window , document ); \ No newline at end of file +})( jQuery, window , document );