点击显示一个隐藏所有其他JS或CSS或"切换"?

时间:2015-10-01 03:39:29

标签: javascript css

我有以下代码:     http://jsfiddle.net/chris_bentley/21onnz5a/

<ul id="header-master-fixed-icon">
<li><a href="#" id="header-master-fixed-search" ></a></li>
<li><a href="#" id="header-master-fixed-account"></a></li>
<li><a href="#" id="header-master-fixed-help"></a></li>
<li><a href="#" id="header-master-fixed-bag"><span id="header-master-fixed-bag-number">5</span></a></li>
</ul>

它们都与点击时弹出的下拉列表有关。我需要发生的是当一个人被点击时其他人关闭。现在当你点击它打开然后下一个打开直到前一个。 所有这些都被关闭,直到被点击。

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

使用jQuery

$('#one_dropbox').click(function()
{
  $('#second_dropbox').hide();
});
相关问题