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 6961387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:31:26+00:00 2026-05-27T15:31:26+00:00

I have a div with overflow set to hidden. Two triggers allow to scroll

  • 0

I have a div with overflow set to hidden. Two triggers allow to scroll items inside the layer with overflow.

I have an overflow div with items hidden. I can scroll the boxes inside the hidden area on click of UP/DOWN elements:

$("#up").click(function(){
    $("#container").find(".box").animate({"top": "+=20px"}, "slow");
});
$("#down").click(function(){
    $("#container").find(".box").animate({"top": "-=20px"}, "slow");
});

<style>
#itemsList {
    height:60px;
}
.box {
    height:20px;
    position:relative;
}
</style>

<div id="container">                        
    <div id="up" class="scroll">UP</div>
    <div id="itemsList">
        <div id="item1" class="box">item 1</div>
        <div id="item2" class="box">qweqweqwe</div>
        <div id="item3" class="box">qqqqqqqq</div>
        <div id="item4" class="box">eeeeeee</div>
        <div id="item5" class="box">rrrrrrrr</div>
        <div id="item6" class="box">tttttt 11</div>
    </div>
    <div id="down" class="scroll">DOWN</div>
</div>

I need to disable .animate() once the scroll reaches first or last elements. The code above works, but it does not stop .animate(). I’ve added some code to check for position of the scrollable elements (see jsfiddle link) but it seems like I messed something up.

Here’s my JSfiddle.

  • 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-05-27T15:31:27+00:00Added an answer on May 27, 2026 at 3:31 pm

    You should look into the ‘ScrollTo’ jquery plugin.. This will allow you to scroll to a specific item (with animation) rather than arbitrarily adding 20px to the scroll position.

    Here is a quasi-working demo. Note that I updated the jQuery to 1.7 and included the scrollTo library http://jsfiddle.net/VP5Xb/12/

    You could also accomplish this easily by obtaining the y coordinate of the items and changing the scrolltop value.

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

Sidebar

Related Questions

I have a DIV with a set height and overflow: hidden . Inside the
I have set a fix height of DIV and set its overflow-y:scroll but the
I have a div with overflow:hidden , inside which I show a phone number
I basically have a div with set dimensions and overflow: hidden . That div
Say I have a div with overflow-x:scroll and overflow-y:hidden. Within that div there is
I have two divs like so <div id=parent style=width:100px:overflow:hidden;> <div id=child> tooooooooooooooooooooo much content
I have a div with an overflow set to hide elements. <div style=overflow:hidden; height:40px>
I have a div that's set to overflow: auto; . This contents of this
I have a div element with fixed height and width and overflow:hidden, and I
I have a container div with the following CSS: #container { position:relative; overflow:hidden; width:200px;

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.