繁体   English   中英

在点击事件中使用上滑和下滑打开msg td

[英]open msg td on click event with slideup and slidedown

单击第一个<tr>时,我想打开另一个<tr>标记。 代码是:

<tr class="msg_inner">
  <td><label>some text</label></td>
   <tr id="full_msg" style="display:none">
       <td><label>Hey There.....</label></td>
   </tr>
</tr>

脚本

$('.msg_inner').click(function(){
        $('#full_msg_'+no+'').toggle("slow");
});

它显示块,但同时都打开。 我想在单击<tr>后显示该块。

不要使用其他<tr> 只需在您的td中添加一个<div> ,然后简单地向他显示

HTML:

<table>
<tr class="line">
<td>
  Hi there !!
  <div class="detail">
  More info here...
  </div>
  </td>
</tr>
<tr class="line">
<td>
  Hi there !
  <div class="detail">
  More info here...
  </div>
  </td>
</tr>
<tr class="line">
<td>
  Hi there !
  <div class="detail">
  More info here...
  </div>
  </td>
</tr>
</table>

的CSS

.detail{
  display:none;
}

jQuery查询

$(".line").click(function(){
$(this).find(".detail").toggle();
});

在这里工作小提琴

您可以尝试以下一种方法:

var x=0;
$(".line").click(function(){

if((x%2)==0)
{
 $(this).find(".detail").show();
}
else
{
  $(this).find(".detail").hide();
}
x++;
});

此处演示

要么

切换方法

$(".line").click(function(){
$(this).find(".detail").toggle(1000);
});

此处演示

暂无
暂无

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

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