1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-13 17:14:04 +02:00

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.
This commit is contained in:
Arnold Daniels
2013-10-22 13:31:23 +02:00
parent 9673c25e2c
commit 5a38a5775f

View File

@@ -62,6 +62,7 @@
return ($href return ($href
&& $href.length && $href.length
&& $href.is(':visible')
&& [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
}) })
.sort(function (a, b) { return a[0] - b[0] }) .sort(function (a, b) { return a[0] - b[0] })