My code looks like this:
<div id="arrow">
<a class="next"></a>
<a class="previous"></a>
</div>
<section id="first">
...
</section>
<section id="second">
...
</section>
<section id="third">
...
</section>
The element #arrow
has position: fixed
, and I'm trying to make the window scroll to the next section
when a.next
is clicked.
Ex: The first time a.next
is clicked, the window scrolls to section#first
, the second time, the window scrolls to section#second
, etc. The same thing happens to a.previous
.
Does someone know how to solve this problem?
Thanks a lot!
EDIT
My JS code:
$('#arrows a.previous').click(function() {
$.scrollTo($(this).closest('section').prev(),800);
});
$('#arrows a.next').click(function() {
$.scrollTo($(this).closest('section').next(),800);
});