How to use Bootstrap scroll spy?

前端 未结 8 565
眼角桃花
眼角桃花 2020-12-08 02:52

I cannot quite get the scroll spy to work properly with a vertical nav. Below you can find the code I use. For some reason, only \"Two\" gets active.

Anyone has an i

8条回答
  •  既然无缘
    2020-12-08 03:44

    Thanks Jerreck I was able to make mine works with the help of

    height: 100%;
    

    in the body selector of my CSS

    Also as recommended by the guys at Bootstrap http://getbootstrap.com/javascript/#scrollspy

    I've added position: relative; in the body too.

    The beginning of the body selector in my CSS goes like this:

    body {
        position: relative;
        height: 100%;
        /* … */
    }
    

    In the in HTML I had to remove

    data-offset="0"
    

    so it is now like this

    
    

提交回复
热议问题