Solved

mouseenter with delay jquery

Posted on 2014-03-13
4
540 Views
Last Modified: 2014-03-13
Hi,

I want to use the mouseenter in jquery but only occurs if the mouse stay entered in a element , in my case a td, for more than 3 seconds, my problem is that occurs inmediately after the mouse enters over the td, any idea?
0
Comment
Question by:joyacv2
4 Comments
 
LVL 58

Expert Comment

by:Gary
Comment Utility
Suggest you look at the hoverintent plugin
http://cherne.net/brian/resources/jquery.hoverIntent.html

Saves messing around with timeouts
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
No points for this comment, please, but I'd just like to vote up the use of something like this with a little delay.  It has to be one of the smarter UX designs I've seen in a long time.  It's amazingly annoying when you have to move the mouse over a piece of the navigation and all the flyouts jump all over the screen.  With hoverIntent, it looks like you can give the client a break from all that.  Great suggestion!
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
Comment Utility
With your own timer : http://jsfiddle.net/XmsBc/

var _in = function() {
    var dis = this;
    var t = setTimeout(function() {
                $(dis).removeData("timer");
                $(dis).addClass("active")
    }, 3000);
    $(this).data("timer",t);
}

var _ot = function() {
    if($(this).data("timer")) {
        clearInterval($(this).data("timer"));
        $(this).removeData("timer");
    }
    $(this).removeClass("active")
}

$("td").hover(_in,_ot);

Open in new window

0
 
LVL 1

Author Closing Comment

by:joyacv2
Comment Utility
perfect!!!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now