Twitter Bootstrap scrollspy always selecting last element

后端 未结 13 1664
旧巷少年郎
旧巷少年郎 2020-12-08 04:22

I have an issue with scrollspy, recreated in this fiddle: http://jsfiddle.net/jNXvG/3/

As seen in the demo, the ScrollSpy plugin always keeps the last menu item sele

13条回答
  •  我在风中等你
    2020-12-08 05:11

    I had a similar issue where scroll spy would not work on anything but a body tag so I actually went into the bootstrap js found the Scroll spy (SCROLLSPY CLASS DEFINITION) section and changed this line:

    , $element = $(element).is('body') ? $(window) : $(element)

    to this:

    , $element = $(element).is('body') ? $(window) : $(window) //$(element)

    (note that the element after the // is a comment so I don't forget I changed it)

    And that fixed it for me.

提交回复
热议问题