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

  • Home
  • SEARCH
  • 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 9127111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:12:27+00:00 2026-06-17T07:12:27+00:00

Keep clicking the down button here: http://thomasgrist.tumblr.com/ until you reach the end. The down

  • 0

Keep clicking the down button here: http://thomasgrist.tumblr.com/ until you reach the end. The down arrow should disappear one click sooner. Any ideas how I can achieve this with the following code?

I’m a noob but I think that I need to right a condition into my else statement and say if index = something do this but I don’t know what the index should be or how to write this.

$('#next').click(function (event) {
  event.preventDefault();
  var $current = $('#listOfWork > .current');
  if ($current.index() != $('#listOfWork > div').length - 1) {
    $("#next").css("display", "inline");
    $("#prev").css("display", "inline");
    $current.removeClass('current').next().addClass('current');
    scrollTo($current.next());

  } else {
    $("#next").css("display", "none");
  }

});

$('#prev').click(function (event) {
  event.preventDefault();
  var $current = $('#listOfWork > .current');
  if (!$current.index() == 0) {
    $("#next").css("display", "inline");
    $("#prev").css("display", "inline");
    $current.removeClass('current').prev().addClass('current');
    scrollTo($current.prev());
  } else {
    $("#prev").css("display", "none");
  }
});
  • 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-17T07:12:28+00:00Added an answer on June 17, 2026 at 7:12 am

    I worked out how to do this. Here is the code. If the next div index value equals the amount of divs minus 2 then don’t show the next button. To hide the previous button when there are no more previous divs we write a condition for when current index equals 1.

    (function() {
    var scrollTo = function(element) {
    $('html, body').animate({
    scrollTop: element.offset().top - headerHeight + 40}, 500);}
    
    $('#next').click(function(event) {
    event.preventDefault();
    var $current = $('#listOfWork > .current');
    if  ($current.index() == $('#listOfWork > div').length - 2) {
    //alert('Current index is ' + !$current.index() + '.');
    $("#next").css("display", "none");
    $("#prev").css("display", "inline");
    $current.removeClass('current').next().addClass('current');
    scrollTo($current.next());
    
    } else if ($current.index() != $('#listOfWork > div').length - 1) {
    //alert('Current index is ' + !$current.index() + '.');
    $("#next").css("display", "inline");
    $("#prev").css("display", "inline");
    $current.removeClass('current').next().addClass('current');
    scrollTo($current.next());
    }    
    
    });
    
    $('#prev').click(function(event) {
    event.preventDefault();
    var $current = $('#listOfWork > .current');
    if ($current.index() == 1) {
    $("#prev").css("display", "none");
    $("#next").css("display", "inline");
    $current.removeClass('current').prev().addClass('current');
    scrollTo($current.prev());
    
    } else {
    //alert('Current index is ' + !$current.index() + '.');
    $("#next").css("display", "inline");
    $("#prev").css("display", "inline");
    $current.removeClass('current').prev().addClass('current');
    scrollTo($current.prev());
    }    
    });
    })
    ();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application here When you open the application, please keep clicking on
I keep getting duplicate entries in my database because of impatient users clicking the
I keep getting an error saying that @android:style/Widget.Holo.Light.Button.Borderless is not public and so can't
I am currently working on media player. When I am clicking the next button
I'm trying to make it so when you press down on a button, the
tried animating a dropdown,worked.But,the height of the element reduces if i keep clicking on
I'm creating a drop down mega menu. The menu only appears when clicking on
I'm using jQuery Quicksand to create a filterable portfolio of articles: http://davekiss.com/new/ The problem
I was going through this tutorial http://www.schillmania.com/content/projects/javascript-animation-1/ and when I institute the code, I
Keep running into When using the multi-mapping APIs ensure you set the splitOn param

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.