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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:38:35+00:00 2026-06-14T07:38:35+00:00

Im trying to do an event on mouseenter and mouseout. If i put mouseover

  • 0

Im trying to do an event on mouseenter and mouseout.
If i put mouseover more than one time it will repeat the number of times i did it, even if still on first animation. Im also trying to stop the animation on mouseleave and animate it back.
Thanks in advance

Here’s the javascript

$('.velejador').mouseenter(function(){
    $('.velejador').animate({
        left: '-=50',
        width: '40px'
      }, 2000);
}).mouseleave(function(){
    $('.velejador').animate({
        left: '+=50',
        width: '40px'
      }, 2000);
});

Here the html

<div id="hidden-cartoons">
    <img src="<?php echo base_url().'assets/img/cartoons/velejador.png' ?>" class="cartoon velejador">
    <img src="<?php echo base_url().'assets/img/cartoons/bodoleite.png' ?>" class="cartoon bodoleite">
</div>
  • 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-14T07:38:36+00:00Added an answer on June 14, 2026 at 7:38 am

    What you are looking for is .stop()

    Try this fiddle

    Two things, I’ve used stop to cancel any currently running animation. Second, I’ve replaced the ‘+=50’ and ‘-=50’ with absolute values because without those, if you keep mousing in and out, the div will end up moving further and further across the screen, which I assume isn’t your objective.

    Another thing to remember is, when do an animation on mouseenter that moves or resizes the element, you may potentially end up firing the mouseout event unless the user “chases” the element as you move it.

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

Sidebar

Related Questions

I have an unordered list (UL) that I'm trying to bind a mouseover/mouseenter event
Im trying to create an ajax (post) event that will populate a table in
I have a canvas under a div and trying to get a mouseenter event
I'm trying to add mouseenter/ mouseleave event handlers that open infowindows with a Google
I have a label whose mouseover event opens up a popup. I am trying
I have a simple mouseover event that I am trying to work on elements
I am trying to apply a style when the mouseenter event is triggered, but
I am trying to play with jQuery mouseenter and mouseleave events but failing. Here
I'm trying to remove event listeners from elements after they've been clicked on and
I've been trying to grab event pictures for a few days now, with no

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.