0

http://codepen.io/theandrewwest/pen/pDEIo

I'm using fullpage.js and have a section with a submenu that navigates through horizontal slides. I want to add an "active" class to the anchor corresponding to the active slide. I know the functionality is built in for navigating vertical sections using the "menu" option, and I have that working for the main nav, but it looks like I'll need to use a callback to add the class to anchors linked to horizontal slides.

I know just enough JS to get plugins working the way I want, but I'm not sure of the best way to set this up. I'm linking to the slides using "data-index" in the pen, but I plan on using custom anchors once I can get them working (no problem with sections, I just can't get them working for slides). I'm not sure if that makes any difference.

1
  • So simply you want to add active class to element which you are clicking right?
    – Just code
    Dec 21, 2013 at 8:43

2 Answers 2

3

Solved. I added a working example at http://codepen.io/theandrewwest/pen/fltAE.

1
  • I would recommend you to add the code of the initialization with the callback rather than just adding a link to the codepen site. That's usually the way to operate here in stackoverflow.
    – Alvaro
    Jan 6, 2014 at 0:43
0

You are using an old version of the plugin. If you take a look at the living demo page you will realize how it adds the active class by default to the active slide. Just check it with firebug or Chrome inspector.

1
  • The active class was being added to the active slide itself, but I needed a way to target the anchor linked to the active slide.
    – Andrew
    Jan 5, 2014 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.