0
#container_im.collapsed{
background-color:red;
height: 48px;
margin-bottom: 10px;
margin-right: 10px;
width: 227px;
}
#container_im.expanded{
background-color:green;
height: 348px;
margin-bottom: 10px;
margin-right: 10px;
width: 227px;
}
#expanded_content{
height:100px;
color: yellow;
display: none;
}
//default state
//expand box
#nav.closed {
height:20px;
width:20px;
background-color: black;
color:white;
}
#nav.opened {
height:20px;
width:20px;
background-color: white;
color:black;
}
HTML:
<div id="container_im" class="collapsed" >
<div id="nav" class="closed">0</div>
box 1 - click me
<div id="expanded_content">
extra content only for collapsed state
</div>
</div>
JS:
<div id="nav" class="closed">0</div>
box 2 - click me
<div id="expanded_content">
extra content only for collapsed state
</div>
</div>
***//
$(document).bind("click", function(e) {
$(e.target).closest("#container_im").toggleClass("expanded");
$(e.target).closest("#expanded_content").show();
$(e.target).closest("#nav").toggleClass("closed");
});***
任何可以帮助我修复这个jQuery代码的JS大师?
- 尝试显示文本#expanded_content以仅在所选框被单击时显示。而隐藏在另一个点击(切换)完整#expanded_content股利和所有子
- 试图再整的#nav DIV,只有一个目前点击
如何使它更好是什么好主意也欢迎, 有点卡住了如何实现上述功能后,尝试从手册中的一些事情,我没有看到在这一点上的功能组合。
这几乎正确地工作,谢谢,我在晚上(晚上)放在晚上的消息,所以这是一个马虎。 Thx p出代表并不知道我可以以这种方式使用 – Rubytastic 2012-01-17 09:55:37
忘了指定正确的答案。我的借口 – Rubytastic 2012-01-24 19:36:18