Closed pankajk1018 closed 10 years ago
Can you provide a link to a test page showing this issue. I'm not sure I understand exactly what you mean.
I too am having this problem. In this example, the 'current' class is correctly applied to the navigation items as you scroll down the page. The href attributes start with a hash: http://hastebin.com/yawosonuwu.xml
If you prefix the hash in the href attributes - eg: "demo.html#section1" - the 'current' class is no longer applied to the navigation items: http://hastebin.com/kojewucopo.xml
just add a $ after the href-attribute selector to match the end of the string and not the whole link line 136:
var $activeLink = this.$container.find("a[href$='" + href + "']");
Thanks! Love wildcards in attribute selectors. I'm actually using one for the 'filter' property. Didn't occur to me that the plugin would use them.
Are you going to commit this change to the next release?
On Mon, Mar 31, 2014 at 1:27 AM, techgyver notifications@github.com wrote:
just add a $ before the attribute selector in line 136: <<< var $activeLink = this.$container.find("a[href='" + href + "']");
var $activeLink = this.$container.find("a[href$='" + href + "']");
-- Reply to this email directly or view it on GitHubhttps://github.com/ChrisWojcik/single-page-nav/issues/4#issuecomment-39026684 .
Thanks for the great fix. I've committed the change.
Thanks that was a great fix..
nailed it :)
On Wed, Apr 23, 2014 at 2:54 PM, pankajk1018 notifications@github.comwrote:
Thanks that was a great fix..
— Reply to this email directly or view it on GitHubhttps://github.com/ChrisWojcik/single-page-nav/issues/4#issuecomment-41124671 .
Hello Chris When i change the url for example "#section1" to "http://localhost/project/#section1" it stops adding current class to that menu item when clicked or scrolled to that related section. Will you please provide any solution for this. Thank you.