SlideToggle 一次仅打开一个容器 Vanilla JS
也许有人知道如何一次只打开一个容器?现在在这个例子中你可以打开所有三个吗?我只想打开一个,打开时将文本更改为“关闭”。有什么想法吗?
以下是 codepen 代码的链接:code
https://codepen。 io/jorgemaiden/pen/YgGZMg
我将非常感谢任何帮助和提示!
Maybe someone know how to open only one container at a time? Now in this example you can open all three? I would like to open only one and when it's opened change text to "Close". Any ideas?
Here is the link with a code to codepen: code
https://codepen.io/jorgemaiden/pen/YgGZMg
I'll be really apreciate for any help and tips!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过多种方式做到这一点,但根据您的参考,我只需添加循环遍历不是您单击的元素的元素的函数,然后删除活动类(如果存在)
You can do it in many ways, but according to your reference, I would just add function that loop through your elements which is not your clicked element, then remove active class if it's present