SlideDown、slideUp 在 jQuery 中不起作用

2023-11-29

嗨,朋友,slideDown 和 slipUp 函数不适用于我的代码。看起来隐藏行没有下滑效果请帮助大家,你可以检查我下面的代码或在这里看到小提琴

HTML

<table>
<tr>
    <td colspan="2"><p>Logistics</p>
      <select name=" " >
        <option>one</option>
        <option>two</option>
        <option>three</option>
        <option>four</option>
        <option>Others</option>
      </select>
    </td>
  </tr>
  <tr>
    <td width="80%" colspan="2"><textarea name=" 5" rows="2" id=" 5" onblur="if (this.value=='') this.value = this.defaultValue" onfocus="if (this.value==this.defaultValue) this.value = ''">Others Details</textarea>
      </td>
  </tr>
</table>

SCRIPT

$('tr').has('textarea').hide();
$('select').on('change',function(){
    if($(this).val()=='Others')
    {
        //$(this).next('tr td').has('textarea').slideDown(200);
        $(this).parent('td').parent('tr').next('tr').slideDown(200);
        //alert('other')
        }
    else
    {
        //$(this).next('tr td').has('textarea').slideDown(200);
        $(this).parent('td').parent('tr').next('tr').slideUp(200);
        //alert('other')
        }
    })

Check this demo jsFiddle

JQuery

$('tr').not(':first').children('td').wrapInner('<div>');
$('select').on('change',function(){
    if($(this).val()=='Others')
    {
        $('td > div').slideDown(2000, function() {
            $(this).parent().slideDown(2000);
        });
    }
    else
    {
        $('td > div').slideUp(1000, function() {
            $(this).parent().slideUp();
        });
    }
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

SlideDown、slideUp 在 jQuery 中不起作用 的相关文章