简体   繁体   中英

Navbar shows wrong active element

Twitter Bootstrap needs this fix in order to not cover the current anchor with the fixed nav-bar

legend {
padding-top: 60px;
margin-top: -60px;} /*fixes that anchor element is under navbar*/

I use data-spy to highlight the nav menue element

<body  data-spy="scroll" data-target=".navbar">

Now when I select a navigation element, the element before gets highlighted. I understand that data-spy still sees a spot of the previous element and therefore does highlights the wrong element.

But how to fix that?

告诉它带有数据属性offset的滚动间谍脚本:

<body data-spy="scroll" data-target=".navbar" data-offset="60">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM