在 jquery 悬停事件中,我使用以下代码下拉菜单:
clearTimeout(hTimeout);
$('#lowermenu').queue('fx', []);
$('#menucenter .current').removeClass('current');
$(this).children('a').addClass('current');
dTimeout = setTimeout(function($item){slidelower($item)}, 200, $(this)); // This is the bad line
function slidelower($li)
{
$li.addClass('dropping');
$lowermenu = $li.children('ul').clone();
$('#lowermenu:not(:animated)').empty().append($lowermenu).slideDown();
$('#lowermenu > ul > li:not(:animated)').hover(function()
{
$(this).children('ul:hidden').css('top', 'auto').slideDown();
}, function()
{
$(this).children('ul:visible').slideUp();
});
}
我收到以下错误:
网页错误详情
用户代理:Mozilla/4.0(兼容;MSIE 8.0;Windows NT 5.1;Trident/4.0;GTB6.3;.NET CLR 1.1.4322;.NET CLR 2.0.50727;.NET CLR 3.0.4506.2152;.NET CLR 3.5。 30729;OfficeLiveConnector.1.3;OfficeLivePatch.0.0) 时间戳:2009 年 11 月 14 日星期六 11:12:46 UTC
消息:“未定义”为空或不是对象
线路:81
字符:25
代码:0
URI:[网址在这里]
我怀疑这是由 setTimeout 引起的——我传入了第三个参数作为匿名函数的参数。该匿名函数调用带有闭包的函数。
任何人都可以帮忙吗?