Search code examples
javascriptjqueryjquery-scrollify

Scrollify.js add class on current section


Am trying to add something like 'active' class on to the current section in a page using scrollify.js.

Am able to get the index value, but not the section id or section class! How to get current section's id or class.

Here is the sample code I tried to achieve.

<section id="first" data-section="first" class="scroll-section"> </section>

before:function(index, sections) {
    alert(index);
},

This return index value. I am trying to get the section id first.

Thanks in advance.


Solution

  • Call $.scrollify.current() it returns the current section.