in Advanced 

Resource preview: Know-how

HomeResource preview:
Log in

jQuery mouseover delay

How to delay a mouseover event. It's really easy. Take a look at the code:



    var showDelay = 500; //will be delayed half a second
    var showTimer = null;

    $('#elementId').live('mouseover', function()
    {
        if (showTimer)//if there is already such event this cancels the setTimeout()
            clearTimeout(showTimer);
        showTimer = setTimeout(function() //executes a code some time in the future
        {
            //you can put here the script that should be delayed
            $('#otherElement').css('display', 'block');
        }, showDelay);
    });



Any comments and other examples would be appreciated!
Vote:
Comments: 1
image xpert
10:48/24.08.2010
I just wonder if this is possible with jQuery queue and dequeue in order to use delay(millis). Function delay is introduced in jquery 1.4.
Please vote! Your opinion matters!
If you want to share knowledge with the others, post a resource
Add resource
Related resources:
| Home | Hall of fame | Registration | Log in | Terms of service | Privacy policy | Help | Contacts | RSS |