3

I have implemented a subnav style Bootstrap scrollspy on my page but odd things seem to be happening. I have four sections, each in a div with I have given an id to. However, when either clicking on the link or scrolling, it is jumping to odd places.

It can be viewed here. http://www.writeupp.com/faq.aspx

Any ideas?

James Allardice
  • 164,175
  • 21
  • 332
  • 312
natlines
  • 7,426
  • 4
  • 17
  • 14
  • I am having similar problems. For some reason when adding tabs inside the area that scrollspy is looking in it causes it to break. Any ideas anyone? Here is the link to where I am experiencing the problem: http://landornewyork.com/diageo/ – Trav McKinney Jun 13 '12 at 15:04

2 Answers2

3

I was having a similar issue that you speak of. Where the top nav flickers when I scrolled. I realized that it was because I had tabbable content on the page. My fix to this was to add data-target=".navbar" to my body element in addition to the data-spy="scroll" so that scrollspy knows which navigation bar to alter. I hope this helps.

<body data-spy="scroll" data-target=".navbar">
Trav McKinney
  • 988
  • 8
  • 24
0

Also note that when using scrollspy in older versions of IE - if your anchors are pointing to html5 elements, e.g. section, your .nav will flicker between the first 2 anchors in the ul. This is because jquery can't figure out the position of these 'foreign' DOM elements. To fix this either use divs instead of sections or use modernizr.js (specifically the html5shiv component).

Check the Modernizr site for more info.

Scotty.NET
  • 12,533
  • 4
  • 42
  • 51