0

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?

Codepen interaction

4

2 回答 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 回答