They wanted to have a simple toggle open close accordion like interaction. Not trying to reinvent the wheel but just trying to learn jquery/javascript. Everything is going smoothly until I tested on firefox. On click my accordion just disappears... is this my fault? jquery's fault? codepen's fault?
问问题
200 次
2 回答
1
像这样更改js代码
$(".x-button").click(function () {
$(".inner-info-container").slideToggle("slow");
$(this).toggleClass("x-button p-button");
return false;//insert this line
});
于 2013-07-25T01:43:48.640 回答
0
您需要return false
在$(this).toggleClass("x-button p-button");
return false
仅表示它不会尝试转到 href 之后添加,它会停止正常的链接行为。
于 2013-07-25T01:48:53.453 回答