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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:56:20+00:00 2026-05-25T09:56:20+00:00

I made a small and simple code that moves a div layer 200 pixles

  • 0

I made a small and simple code that moves a div layer 200 pixles up and down. But I want it to move the layer on click instead of mouseover. mouseleave is still ok!

How do I do a check if the layer is up or down. I want to move the layer -200px only if the layer is up 200px.

<script>
  $(".block").mouseenter(function() {
   $(".block").animate({"bottom": "+=200px"}, 300);
  }).mouseleave(function() {
      $(".block").animate({"bottom": "-=200px"}, 200);
  });
</script>
  • 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-25T09:56:22+00:00Added an answer on May 25, 2026 at 9:56 am

    use a class

    <script>
      $(".block").click(function() {
       $(".block").not('.up').addClass('up').animate({"bottom": "+=200px"}, 300);
      }).mouseleave(function() {
       $(".block").filter('.up').removeClass('up').animate({"bottom": "-=200px"}, 200);
      });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a code that translate strings to match each word from the array
I've made a small script in my machine, and an alias in .bashrc that
I have a bug in my code that made me think I don't fully
I made a class that derives from Component: public class MyComponent: System.ComponentModel.Component { }
I made a UIView using Interface Builder with a top bar that has Cancel
I am trying to place a series of sprites on a layer, but since
i made a small test app with 2 screens. the first screen contains an
I've made a small example with a Person class, which contains a list of
I've made a simple resource packer for packing the resources for my game into
I'm currently involved in a project that is migrating some old VB6 code to

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.