on() 不支持hover事件

 

因为 .hover() 是 jQuery 自己定义的事件… 是为了方便用户绑定调用 mouseenter 和 mouseleave 事件而已,它并非一个真正的事件,所以当然不能当做 .bind() 中的事件参数来调用。

 

    $("body").on("mouseenter","#standard-answer tr",function(){
        var n = $(this).index();
        $("body").find("#student-answer tr").eq(n).css("background","#AFFCF7");    
        });
    $("body").on("mouseleave","#standard-answer tr",function(){
        var n = $(this).index();
        $("body").find("#student-answer tr").eq(n).css("background","");    
        });

 

posted @ 2017-06-29 09:32  boyanh  阅读(913)  评论(0)    收藏  举报