From: Arnold Daniels Date: Tue, 22 Oct 2013 11:31:23 +0000 (+0200) Subject: Scrollspy acting up when targets are hidden X-Git-Tag: v3.1.0~130^2~13^2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a38a5775f8a3c58c09df0a0f3afc058c820c238;p=thirdparty%2Fbootstrap.git Scrollspy acting up when targets are hidden If elements are hidden using `display: none;` which are targets mapped by scrollspy, the plugin might select an incorrect or no menu item. Checking if the target is visible solved this. --- diff --git a/js/scrollspy.js b/js/scrollspy.js index 10f95f249a..08319dd180 100644 --- a/js/scrollspy.js +++ b/js/scrollspy.js @@ -62,6 +62,7 @@ return ($href && $href.length + && $href.is(':visible') && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null }) .sort(function (a, b) { return a[0] - b[0] })