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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:11:25+00:00 2026-05-28T01:11:25+00:00

this is probably very simple using javascript or jquery, but I cannot wrap my

  • 0

this is probably very simple using javascript or jquery, but I cannot wrap my head around it. I am providing a sample using a simple css box with a :hover applied in a different color. I want the box to go about the hover as it normally would, but then want the hover to last a set amount of time, regardless of mouse movement after hover. After the set time has finished, I would like the hover to reset as normal. Also if the user were to accidentally hover over the #box while the hover is being held it will not reset, it will continue to hold until after the set time has finished.

here is my html and css

    #box {
            width: 200px;
            height:300px;
            background-color: #00CCFF; 
    }

    #box:hover {
            width: 200px;
            height:300px;
            background-color: #669933;
    }

    <!DOCTYPE html>
<html>
<head>
</head>
<body>    
    <div id="box" </div>

</body>
  • 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-28T01:11:25+00:00Added an answer on May 28, 2026 at 1:11 am

    CSS

    .box-normal {
            width: 200px;
            height:300px;
            background-color: #00CCFF; 
    }
    
    .box-hover {
            width: 200px;
            height:300px;
            background-color: #669933;
    }
    

    HTML

    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>   
    
       <div id="box" class="box-normal"> dsfdsf</div>
    
    </body>
    

    JQuery

    $(function() {
    var delayms = 2000;
    
    $("#box").mouseenter(function(){
        if ($("#box").hasClass('box-normal'))
        {
             $("#box").removeClass('box-normal').addClass('box-hover');
             window.setTimeout(function() {
                 $("#box").removeClass('box-hover').addClass('box-normal'); 
             }, delayms); 
        }     
    }); 
    
    }); 
    

    You can change the “delayms” variable. ( 2000 means 2 seconds)

    Working example: http://jsfiddle.net/jqT7d/1/

    Also jfriend00 suggests a simpler version: http://jsfiddle.net/jfriend00/jqT7d/3/

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

Sidebar

Related Questions

This is probably VERY simple and silly, but I am trying to use jQuery
This is probably very simple but it's really confusing me. When I implement the
I know this is probably a very simple question but how would I do
This is probably very simple, but I'm quite new to ruby and active record.
Okay, this is (probably) a very simple question, but I am afraid I know
This is probably a very simple problem but forgive me as I am new.
This is probably very straight forward and simple, but I'm very new and noob
This is probably very simple, but my attempts (guided by Intellisense and MSDN) have
This is probably a very simple task to perform but I'm taking the risk
There is probably a very simple answer to this, but I want to be

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.