Skip to content
This repository was archived by the owner on Jan 24, 2018. It is now read-only.

Check Active Link Href#25

Open
SuPa86000 wants to merge 2 commits intoPrinzhorn:masterfrom
SuPa86000:master
Open

Check Active Link Href#25
SuPa86000 wants to merge 2 commits intoPrinzhorn:masterfrom
SuPa86000:master

Conversation

@SuPa86000
Copy link
Copy Markdown
Contributor

Just a idea for check the active link by href attribute. Works with several menu containing the same links.

Usage example :

skrollr.menu.init(app.skrollr.instance, {
    [...]
    activeSubstract: function(link) {
        var href = $(link).attr('href');
        if(href == '#services') return 180;
        else return 80;
    },
    [...]
});

$(window).scroll(function(){
    $('#navigation a[href='+skrollr.menu.getActiveHref()+']').addClass('active');
});

@shelby-carter
Copy link
Copy Markdown

@SuPa86000 a lot of thanks, you commit made my life for this evening a bit easier. :)

@monicaaikorice
Copy link
Copy Markdown

Does this change the menu links' active state while scrolling? Or just on-click?

@shelby-carter
Copy link
Copy Markdown

@mishmomo

while scrolling

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants