]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Scrollspy acting up when targets are hidden 11203/head
authorArnold Daniels <arnold@jasny.net>
Tue, 22 Oct 2013 11:31:23 +0000 (13:31 +0200)
committerArnold Daniels <arnold@jasny.net>
Tue, 22 Oct 2013 11:31:23 +0000 (13:31 +0200)
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

index 10f95f249a56a7c44a57466d01b130dee4a23190..08319dd180cf317190b626c1fa19fe55b1749bf1 100644 (file)
@@ -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] })