From 5a38a5775f8a3c58c09df0a0f3afc058c820c238 Mon Sep 17 00:00:00 2001 From: Arnold Daniels Date: Tue, 22 Oct 2013 13:31:23 +0200 Subject: [PATCH] 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. --- js/scrollspy.js | 1 + 1 file changed, 1 insertion(+) 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] })