Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8378363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:54:47+00:00 2026-06-09T15:54:47+00:00

When I click an arrow button, a window scrolls to the next element, but

  • 0

When I click an arrow button, a window scrolls to the next element, but when I scroll down and click a random element, it would first go back to the element I clicked before, or, if I don’t click, it goes to the first element.

I want it to scroll next to current clicked element. Everything is bubbling.

The site I working on, where the situation appears – http://dawidjarzabek.pl/test

jQuery:

var currentElement = $(".post");

$('.post #nav a.prev').click(function() {
    currentElement = currentElement.prev();
    $.scrollTo(currentElement, 800);
});

$('.post #nav a.next').click(function() {
    currentElement = currentElement.next();
    $.scrollTo(currentElement, 800);
});

HTML:

<div id="1" class="section">

    <div class="post position">
        <div id="photo"><center><img src="photos/studio/1.jpg" /></center></div>
        <div id="nav"><a class="prev"><img src="images/icon_top.png" /></a><a class="next"><img src="images/icon_bottom.png" /></a></div>
        <div id="text">
            <h1>Modelka: </h1>
            <h2></h2>
            <h1>Wizaż : </h1>
            <h2></h2>
        </div>
    </div>
    <div class="post position">
        <div id="photo"><center><img src="photos/studio/2.jpg" /></center></div>
        <div id="nav"><a class="prev"><img src="images/icon_top.png" /></a><a class="next"><img src="images/icon_bottom.png" /></a></div>
        <div id="text">
            <h1>Modelka: </h1>
            <h2></h2>
            <h1>Wizaż : </h1>
            <h2></h2>
        </div>
    </div>
</div>

[the rest .post and .section]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:54:49+00:00Added an answer on June 9, 2026 at 3:54 pm

    Try this:

    $('.post #nav a.prev').click(function() {
        $.scrollTo($(this).closest('.post').prev(),800);
    });
    
    $('.post #nav a.next').click(function() {
        $.scrollTo($(this).closest('.post').next(),800);
    });
    

    And you don’t have to store variable currentElement. 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On click on next button, the list should highlight/select next item in the listview.
always in a ComboBox a arrow button is show where user click and then
What signal is emmitted if I click on QToolButton's arrow part of a button?
I want to have a select drop down but it would only show the
When you click on the button, all checkbox inside the list element should get
How to Navigate to another page when click on arrow in the pushpin layout?
click the button to call this method: private void goRegister(final boolean isUsername) { new
I click the button and nothing happens. If I take out the validation code,
I'm trying to work with a jQuery script I found at http://marcgrabanski.com/articles/scrollto-next-article-button-jquery that allows
I want to have a button on my toolbar that has a little down

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.