Solved

mouseenter with delay jquery

Posted on 2014-03-13
4
600 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 58

Expert Comment

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

Saves messing around with timeouts
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39927674
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
ID: 39927708
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
ID: 39927733
perfect!!!
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

751 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