我运行以下代码来创建一个下拉式折叠面板,当"#top_mailing“分区悬停时,它会显示隐藏的分区"#top_mailing_hidden”。问题是,当我通过鼠标移出然后再次鼠标移到上面来中断动画时,它会中止动画并搞砸。
我有以下代码:
//Top Mailing List Drop down animation
$(document).ready(function () {
$('#top_mailing')
.bind("mouseenter",function () {
$("#top_mailing_hidden").stop().slideDown('slow');
})
.bind("mouseleave",function () {
$("#top_mailing_hidden").stop().slideUp('slow');
});});
Brian Cherne的插件要求按如下方式调用hoverIntent函数(其中'makeTall‘和'makeShort’是已定义的函数:
$("#demo2 li").hoverIntent( makeTall, makeShort )我认为我得到的行为的最好的解决方案是使用Brian Cherne的"HoverIntent“jQuery插件。问题是我不知道如何/在哪里插入上面的代码来调用HoverIntent插件。它说调用".hoverIntent“而不是.hover,但我的代码使用的是.bind("mouseEnter"...谁来帮帮忙!
发布于 2010-02-04 08:04:15
您仍然可以在hoverIntent中使用匿名函数:
$('#top_mailing').hoverIntent(function () {
$("#top_mailing_hidden").stop().slideDown('slow');
},
function () {
$("#top_mailing_hidden").stop().slideUp('slow');
});https://stackoverflow.com/questions/2196429
复制相似问题