Home  >  Article  >  Web Front-end  >  js hover timer (example code)_Basic knowledge

js hover timer (example code)_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 17:16:011314browse

复制代码 代码如下:

$("#showComp tr:not('.stlisttitle')").hover(function(){
        try{if($("#calendarPanel").is(":visible")) $(".playerlist").hide();else{clearTimeout(timMess);
        $(".playerlist").css("top",$(this).offset().top-$(".calendarCon").offset().top-30).show();}}catch(e){}

    },function(){
        timMess=setTimeout(function(){
            $(".playerlist").hide();
         },300);

        //$(this).css("background","");
    });   
    $(".playerlist").hover(function(){
        clearTimeout(timMess);
    },function(){
        timMess=setTimeout(function(){

            $(".playerlist").hide();

         },300);
    });


效果如图:
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn