Tcmxc
Tcmxc

Reputation: 491

How do you make a .hover delay in jquery

I have a slider with thumbnails under the slides. I want to hover over the thumbnail image and change the slide. Is there a way to hover over a thumbnail img wait a second then change the slide to match the thumbnail?

    $(function(){

        $("#main-photo-slider").codaSlider();

        $navthumb = $(".nav-thumb");
        $crosslink = $(".cross-link");

        $navthumb.hover(function() {
            var $this = $(this);
            theInterval($this.parent().attr('id').slice(1) - 1);
            return false;
        } );

        theInterval();
    });

This is what I have and it works but it doesn't have a 1 second time lapse

Upvotes: 1

Views: 69

Answers (1)

Jack
Jack

Reputation: 8941

Try this.

$navthumb.hover(function() {
    var $this = $(this);
    setTimeout(function(){
        $this.parent().attr('id').slice(1) - 1);
    }, 1000);
    return false;
} );

Upvotes: 2

Related Questions