简体   繁体   English

jQuery手风琴/切换面板-仅关闭/打开特定的类

[英]jQuery Accordion/Toggle Panel - Only close/open specific classes

Community! 社区!

I really need your help now. 我现在真的需要你的帮助。 I wanted to make an accordion in which I can open all Tabs. 我想制作一个可以打开所有标签的手风琴。 By searching the Web I found a good solution: 通过搜索网络,我找到了一个很好的解决方案:

http://jsbin.com/eqape/968/edit http://jsbin.com/eqape/968/edit

The first Div-Container of each Section is the one who closes/opens up. 每个部分的第一个Div-Container是关闭/打开的那个。 I want to define 3 div-Containers. 我想定义3个div容器。 One at the top (always displayed), one in the center (with the toggle-functionality) and one on the bottom (always displayed). 一个在顶部(始终显示),一个在中央(具有切换功能),另一个在底部(始终显示)。 Is this possible ? 这可能吗 ? And how can I do this ? 我该怎么办呢? I'm new to jQuery so this drives me crazy. 我是jQuery的新手,所以这使我发疯。

Thank you, guys! 感谢大伙们!

I think you're trying too hard. 我想你太努力了。 If I understand correctly, you simply want any .top to toggle the adjacent .content. 如果我理解正确,您只是希望任何.top切换相邻的.content。 Since I'm more familiar working in JSFiddle, I've set the code up there: 由于我对JSFiddle的工作更加熟悉,因此我在此处设置了代码:

http://jsfiddle.net/SuyS2/1/ http://jsfiddle.net/SuyS2/1/

$('.top').click(function () {
  $(this).next('.content').slideToggle();
});

Let me know if I'm missing something. 让我知道我是否想念一些东西。

UPDATE: 更新:

If you had wanted the sections and the inner content to toggle, you could do this: 如果您希望切换各节内部内容,则可以执行以下操作:

http://jsfiddle.net/SuyS2/5/ http://jsfiddle.net/SuyS2/5/

$('.section-heading').click(function () {
  $(this).next('.section-wrapper').slideToggle();
});

$('.top').click(function () {
  $(this).next('.content').slideToggle();
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM