meow-meow-meow
meow-meow-meow

Reputation: 518

Scrollify move to specific section

I have 3 Scrollify sections. I also have 2 buttons, I need one button to scroll to the 2nd section and the other button to scroll to the 3rd section.

The Documentation lists this method:

$.scrollify.move("#name");

"The move method can be used to scroll to a particular section. This can take the index of the section, or the name of the section preceded by a hash."

Here's my broken demo:

CODEPEN DEMO

HTML

<div class="section third" data-div-name="third"></div>

JS

This works:

$('.link2').click(function(){
  $.scrollify.next();
});

But this doesn't:

$('.link3').click(function(){
  $.scrollify.move("third");
});

or using "#third" or ".third"

Any ideas? Am I not using data-div-name correctly?

Upvotes: 2

Views: 5331

Answers (2)

Lakshman
Lakshman

Reputation: 13

HTML

<div class="section third" data-section-name="third"></div>

JS

$('.link3').click(function(){
    $.scrollify.move("#third");
});

Code Pen: https://codepen.io/lakshmanpalitha/pen/gOorGBK

Upvotes: 0

meow-meow-meow
meow-meow-meow

Reputation: 518

I figured it out, it's a hashed index number not data name:

$('.link3').click(function(){
  $.scrollify.move("#3");
});

updated the demo

Upvotes: 1

Related Questions