jimmynotjim / scrollnav

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

scroll-nav__section is not adding properly #40

Closed amitmondal50 closed 10 years ago

amitmondal50 commented 10 years ago

Hi Jimmy. I loved this stuff made by you, especially the the particular section remain highlighted in the navigation when we are viewing that part in the browser. I want to achieve that but somehow facing problem. I 'm attaching my code below.

```

Part One plus

hohohahahah

hohohahahah

Part Two plus

hohohahahah

hohohahahah

```

And I add this inside script $('.whole').scrollNav({ sections: '.abc .my-count .my-no', subSections: true, sectionElem: 'sections', showHeadline: true, headlineText: 'Subject', showTopLink: false, topLinkText: false, fixedMargin: 40, scrollOffset: 100, animated: true, speed: 500, insertTarget: '.my-cool-nav', insertLocation: 'appendTo', arrowKeys: false, onInit: null, onRender: null, onDestroy: null });

I wrote my css. So dont worry bout styling. As well as I added .active ! .scroll-nav__item.active { -webkit-transform: scale(1.2, 1.2); -moz-transform: scale(1.2, 1.2); -ms-transform: scale(1.2, 1.2); -o-transform: scale(1.2, 1.2); transform: scale(1.2, 1.2); padding-left: 0.5em; font-weight: 800; }

Now, though I get the navigation like this Day Part One Part Two

but when I click on Part One/Part Two in the navigation the scrolling works fine but it stays highlighted only for the Part One/Part Two portion, not its content. What I want is keep the navigation same but keep the Part One, Part Two portion highlighted until I'm not moving from Part One, Part Two's contain as well. So If I viewing Part One's content the Part One in the navigation will be stayed highlighted. Same for Part Two as well.

Hope I manged to elaborate the problem? Thanks a lot in advance. Hope you help.

jimmynotjim commented 10 years ago

Hi there. Could you put your example up on jsfiddle so that I can help you debug the issue? It's a bit hard just looking at it statically.

jimmynotjim commented 10 years ago

I just looked at this again and noticed that you've defined the sectionElem as sections (plural). It must be an html element, so it needs to be singular as in section.