如果单击div.msg_head,则.msg_row将使用动画向下滑动,这在我的示例中有效.我的问题是我正在尝试编写一个函数,在关闭所点击的第二条消息之前关闭所有消息窗格.
这是一个例子:
我知道你在滑下新的窗格之前尝试滑动所有其他窗格.这样只有一个窗格会保持打开状态.
足够简单:不要使用切换.
var $allMail = $(".msg_head");
$allMail.click(function() {
var $this = $(this);
if( $this.hasClass('opened') ) {
$this.removeClass('opened').slideUp();
} else {
// assuming 'body' is the class of the div you want to show/hide
$allMail.removeClass('opened').find('.body').slideUp();
$this.addClass('opened').find('.body').slideDown();
}
);
Run Code Online (Sandbox Code Playgroud)
希望这是你正在寻找的.
干杯!
| 归档时间: |
|
| 查看次数: |
161 次 |
| 最近记录: |