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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:15:57+00:00 2026-06-10T19:15:57+00:00

When I click in my menubar, I have a div going down from the

  • 0

When I click in my menubar, I have a div going down from the top. I need to make a function that upon the button link being clicked again it returns to the top. This is what I have tried so far:

HTML:

<div id="wrapper"><button id="top">&raquo;</button></div>
<div class="block"></div>

Javascript:

$("#top").click(function(){
  $(".block").animate({"top": "+=300px"}, "slow");
});

CSS:

div {
  position:absolute;
  background-color:#abc;
  left:50px;
  width:90px;
  height:90px;
  margin-top:5px;
}

#wrapper {

    top: 80px;
 }  


.block {
     margin-top:-95px;
  }   
​

Live DEMO

  • 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-10T19:15:58+00:00Added an answer on June 10, 2026 at 7:15 pm
    $("#top").on('click', function(){
        var elm = $(".block");
        elm.animate({"top": ((parseInt(elm.css('top'), 10)>10?"-=":"+=")+"300px")}, "slow");
    });​
    

    FIDDLE

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

Sidebar

Related Questions

I click on a link from one page that does a redirect to another
I have a menubar and tabs the code like below: <div id=menu> <ul> <li><a
I have written code to perform click event on JMenuItem but that is not
In Qt, I have a menubar that looks something like this: |File| +-------------------+ |Do
I have got a button that only appears when it hits a certain media
I have an application that has a main GUI with a menubar, and another
I have found a problem. When i click on HorizontalLayout (which contains MenuBar) then
click the button to call this method: private void goRegister(final boolean isUsername) { new
Click here to see what I mean.. What could prevent these two from sitting
Click on this link , you will be redirected to a shopping site. On

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.