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

Check Active Link Href #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

SuPa86000
Copy link
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

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

@monicaaikorice
Copy link

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

@shelby-carter
Copy link

@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