开发者

jquery: menu show at mouseover

$(document).ready(function () {
    $('img.menu_class').click(function () {
    $('ul.the_menu').slideToggle('medium');
    });
    $('.img.m开发者_开发百科enu_class').mouseover(function() {
    $('ul.the_menu').slideToggle('medium');
    });
});

I've added this mouseover, but it doesnt work, only if i click.. What have i done wrong?


You should use mouseenter and mouseleave insted of mouseover because mouseover is triggered every time the pointer moves into the child element and mouseenter only when the pointer moves into the bound element.

$('img.menu_class').bind("mouseenter", function () {
    $('ul.the_menu').slideToggle('medium');
});
$('ul.the_menu').bind("mouseleave", function () {
    $('ul.the_menu').slideToggle('medium');
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜