ChrisWojcik / single-page-nav

jQuery plugin that provides smooth scrolling and advanced navigation for single page websites.
http://chriswojcik.net/demos/single-page-nav/
161 stars 75 forks source link

Add active to li instead of a #7

Closed IronTony closed 7 years ago

IronTony commented 10 years ago

Hello,

as I wrote in the title, the active class is added to a, please correct me if I am wrong. How can I add it to the li instead of a?

Example with actual code: < li> < a href="#home" class="active">Homepage < /li>

How can I modify to have this? < li class="active"> < a href="#home">Homepage < /li>

IronTony commented 10 years ago

I have modified the CSS directly and I figured it out.

I just do not know why if I scroll the class="" is added/removed each mouse wheel tick.

ChrisWojcik commented 10 years ago

You're correct that the plugin doesn't support adding the active class onto something other than the '' tag.

It would be a helpful feature to be able to add the active class to a different element, however I can't think of a clear way of coding this such that it's easily configurable.

Open to suggestions, but I will have to leave this open for now.

scibuff commented 10 years ago

Hmmm, it seems to me that in version 1.1.0 the current class was applied to the container of the 'a' element, e.g. <li class="current"><a href="#header">Home</a></li>

But, going to 1.2.0 the current class is applied to the 'a' element itself

<li><a href="#header" class="current">Home</a></li>

which (1) breaks sites which were using 1.1.0, and (2) is not compatible with frameworks/products such as Wordpress.