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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:44:53+00:00 2026-06-01T02:44:53+00:00

Is it possible to show and hide divs like scrolling style with mousedown() from

  • 0

Is it possible to show and hide divs like scrolling style with mousedown() from div1 to div5 ?
I have just developed a function which is scrolling down and up. which is working fine.
Can we change this function to show div1, div2…. when mousedown() viseversa for mouseup() ?

The thing is that show only one div at a time

enter image description here

here is my present JQuery code

$(document).ready(function() {
    var mouseisdown = false;
    $('.up').mousedown(function(event) {
        mouseisdown = true;
      var topVal = $(".content").css("top").replace(/[^-\d\.]/g, ''); //remove the px from the current top val
        topVal = parseInt(topVal);
      console.log(topVal);
      if(topVal < 0){ //This is to stop it when it reaches the top
      $('.up').parents(".container").find(".content").stop().animate({"top":topVal + 20  + 'px'},'slow');
        if (mouseisdown)
    setTimeout(ScrollUp, 400); 
      }
    }).mouseup(function(event) {
        mouseisdown = false;
    });

    $('.dn').mousedown(function() {
        mouseisdown = true;
          var topVal = $(".content").css("top").replace(/[^-\d\.]/g, '');
        topVal = parseInt(topVal);
      console.log($(".content").height()+ " " + topVal);
      if(Math.abs(topVal) < ($(".content").height() - $(".container").height() + 60)){ //This is to limit the bottom of the scrolling - add extra to compensate for issues
      $('.up').parents(".container").find(".content").stop().animate({"top":topVal - 20  + 'px'},'slow');
        if (mouseisdown)
    setTimeout(ScrollDown, 400);
      }
    }).mouseup(function() {
        mouseisdown = false;
    }); 
});

CSS

  div.container {
  overflow:hidden;
  width:250px;
  height:200px;
    zoom: 1;  /* IE7 Fix - doesnt work */
  }
  div.content {
    position:relative;
    top:0;
    left: 110px; /*this is for demo - it cuts off the text */
    zoom: 1; /* IE7 Fix - doesnt work */
    clear:bothl;
  }
  .up, .dn{
      border:1px solid orange;
    cursor: pointer;
  }
  .up:hover, .dn:hover{
      background-color:yellow;
  }

HTML

<div class="container">
    <button class="up">Up</button> &nbsp; 
    <button class="dn">Down</button>
    <hr style="clear:both;"/>

  <div class="content">
     <div id="div1"><p>Dolore magna  aliquam  erat volutpat.</p><p> Suscipit  lobortis  nisl ut aliquip ex ea consequat.</p></div>
     <div id="div1"><p>Suscipit  lobortis  nisl ut aliquip ex</p><p> ea commodo Dolore magna  aliquam  erat volutpat.</p></div>
     <div id="div1"><p>Dolore magna  aliquam  erat volutpat.</p><p>Suscipit  lobortis  nisl ut aliquip ex ea consequat.</p></div>
  </div>
</div>

need to show to show like this here many we can see. I need to show only one div at a time
similar

  • 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-01T02:44:55+00:00Added an answer on June 1, 2026 at 2:44 am

    Here: http://jsfiddle.net/8HQKR/1/ or with toggling http://jsfiddle.net/8HQKR/3/. Just use jQuery show and hide functions on mouseup and down. You can also use .css(‘display’,’none’) and .css(‘display’,whatever). Or setting display:none; as a rule in a css class then addClass and removeClass. If you go by adding and removing classes, take a look at .toggleClass.

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

Sidebar

Related Questions

Possible Duplicate: JQuery Show hide class on hover just like stackoverflow, when you hover
It's possible to show/hide the application's icon from both the Dock and the Task
I would like to have a drop down menu with jQuery show and hide
I have my site built with jquery show/hide divs and want to have a
Possible Duplicate: How to show/hide a div on mouseover using jquery? I have a
I need to show/hide some divs depending on selected options. I'm using .change function.
Possible Duplicate: How to show/hide a div on mouseover using jquery? I have a
I have little piece of javascript to show/hide divs based on which link is
Possible Duplicate: Show and hide divs at a specific time interval using jQuery I
Possible Duplicate: Hide/Show Navigation & Tool Bar on tap This is the void I'm

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.