jimmynotjim / scrollnav

A dependency free JavaScript plugin for auto generating single page navigation
http://scrollnav.com
MIT License
461 stars 127 forks source link

sub-item active class not updating properly on Chrome #70

Closed daitantools closed 8 years ago

daitantools commented 8 years ago

Hey there!

So, I've been using this plugin for development, and during tests I found out that the active class for the sub-item is not updating properly for Google Chrome - the page is getting positioned correctly, but the active class goes to another unrelated section. It's working on Firefox and even IE8, only Chrome is giving this problem!

When I open the Developer Tools (Inspector) with the Disable Cache option set to true, the active works properly. But if I close the Inspector and reload the page, the problem come back!

Any ideas why this is happening? I'm using JQuery 1.12.1 with Bootstrap.

jimmynotjim commented 8 years ago

Hmm, I haven't seen this bug yet. Thanks for bringing it forward. Can you recreate on something like CodePen so I can see it in action?

jimmynotjim commented 8 years ago

@faltza were you able to recreate this issue in something testable like jsfiddle or CodePen? If not, I'll have to close this issue as I can't recreate it.

daitantools commented 8 years ago

Hey @jimmynotjim! Sorry, I've been jammed with work lately - I will copy part of the code I had that was buggy and re-create it on CodePen later today or tomorrow :)

jimmynotjim commented 8 years ago

@faltza no pressure, because I'm obviously the worst at keeping up on everything, but I'm around to work on things the next two weeks then I'll be intermittent again. If you can get a demo of the issue I'll put some serious effort behind fixing it.

daitantools commented 8 years ago

Hey Jimmy!

So, I created an example of the same structure I had and guess what? It's working: https://codepen.io/hipertales/pen/wGNvdq

The bug was: If I clicked on Sub4, for instance, it jumped to Sub8 or the active even disappeared from the screen. The only difference is that I'm using Bootstrap and a lot of rows and grids between the h2 and h3 (sections and subsections), which I tried to simulate with that hard-coded div with the image.

I wasn't the only one experiencing this, and since I had little time in my hands I had to create something with pure JS, but I will try to use ScrollNav again and see if I can find the root of the problem :)

Btw, my suggestion is that you upload the project to some CDN - at least for testing purposes, it's much easier!

Thanks for the help and sorry for taking so long to get back to you ;)

jimmynotjim commented 8 years ago

Weird. I'm glad it's working now. I'll definitely look into adding it to a CDN.