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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:48:11+00:00 2026-05-16T08:48:11+00:00

I created an h1 element that gets a class added to it and removed

  • 0

I created an h1 element that gets a class added to it and removed from it with a duration of 300ms when the mouse hovers over and off of it’s containing DIV #logo using jQuery‘s .hover() method in concert with jQuery UI‘s .addClass() and .removeClass() methods.

It works splendidly but only when the user hovers over #logo and stops to wait for .addClass() method to complete adding the new class to the h1 which takes 300 milliseconds total. If however the user moves off of the #logo DIV before the .addClass() method’s 300 milliseconds are up, the jQuery .addClass() or .removeClass() method(s) get(s) paralyzed. Trying to move the cursor back into the #logo does not affect the h1 anymore. It is locked into place for good until a browser refresh. Unacceptable.

You can view and try out my example at JS Bin over here *.

Try hovering over the #logo DIV box in the center of the screen slowly, you know, wait for the animation to complete. Then move the cursor off of it. All is well. Now try to just move the cursor quickly over the #logo DIV and you will see it lock up.

What code changes do I have to make in order to get this jQuery lock up from occurring?

EDIT: @pointy pointed me in the right direction. I got it to stop locking up by applying .stop(true,true) before the .addClass('hover',300) as well as applying it before the .removeClass('hover',300)

  • 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-16T08:48:11+00:00Added an answer on May 16, 2026 at 8:48 am

    Stick a “stop” call in before the “removeClass”:

    $('h1').stop(true, true).removeClass('hover', 300);
    

    That jQuery UI class animation stuff is tricky.

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

Sidebar

Related Questions

Here I created a jquery function that gets css-color and creates element with background
I have problems setting the focus on an input element that has been created
I created a date picker that uses ajax to populate an element with an
I have a Mootools class that creates an element. I need to add a
I'm trying to create an effect where if the user hovers the mouse over
I have an activity class that gets a JSON string by making a query.
I'm writing classes which (de)serialize to/from XML. When serializing and deserializing, the class gets
I have an application that gets information from google calendar by getting them from
I am trying to create a select element that has a list of numbers
I recently created a advanced form with elements that use jquery's $().hide & $().show

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.