What is the minimum code to make ScrollSpy bootstrap sidebar like the example?

前端 未结 2 370
刺人心
刺人心 2020-12-12 22:38

I have seen the left hand ScrollSpy example on the bootstrap page:

http://twitter.github.io/bootstrap/2.3.2/javascript.html#scrollspy

But they don\'t have an

2条回答
  •  半阙折子戏
    2020-12-12 23:34

    See if this helps: http://jsfiddle.net/panchroma/rWYQu/

    1. In the body tag add
      ( see fiddle options left hand column)

    2. Wrap your side nav bar in a div with this same data-target ID:

    3. You probably want to add the class affix to your side nav so that it stays in place:

    That's it!

    EDIT

    How do I get it to style like the Bootstrap example on their site though?

    Here's a variation if you want stying similar to the bootstrap page
    http://jsfiddle.net/panchroma/ExWDq/

    You will see that I've changed the classes on the nav list ul to make better use of some built in Bootstap styling, I've added chevrons to the menu links, and added styling and media queries for the nav list.

提交回复
热议问题