gpt4 book ai didi

javascript - jQuery 函数不能与另一个函数一起使用

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:27:23 25 4
gpt4 key购买 nike

我有两个函数可以加载文档就绪。当它们单独运行时,它们工作正常。但是当在同一个文档上调用这两个函数时,准备好 js。其中之一(第二个)不起作用。请帮忙。这些文件设置在: http://jsfiddle.net/rexonms/FXPhu/15/

基本代码如下,在文档就绪时调用。它调用 jQuery 1.2.6 - 它是一个封闭的 CMS,我无法更改 jQuery 的版本:

// Sidebar Accordion Nav
$("#linkListSub3 li li").hide();

$("#linkListSub3 li").hover(function() {
if ($("li", this).is(":hidden")) {
$("#linkListSub3 li li").next().slideUp();
$("li", this).next().slideDown();
}
return false;
});


//Hide And show Toggle Bar animation
$(".toggleContainer").hide(); //Hide (Collapse) the toggle containers on load

//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
$("a.trigger").click(function() {
$(this).toggleClass("active").next().slideToggle("slow");
return false; //Prevent the browser jump to the link anchor
});

最佳答案

只传递了一个参数,对 hover 的调用就失败了。添加一个空函数作为第二个参数,它起作用了。

http://jsfiddle.net/FXPhu/19/

关于javascript - jQuery 函数不能与另一个函数一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8344195/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com