$(document).ready(function () { $("#newrecord tr:odd").addClass("odd"); $("#newrecord tr:not(.odd)").find("li").hide(); $("#newrecord tr:not(.odd)").hide(); $("#newrecord tr:first-child").show(); $("#newrecord tr.odd").click(function () { $("#newrecord tr:not(.odd)").show(); $(this).next("tr").find("li").slideToggle("slow","swing"); }); });
下面首先隐藏所有偶数行,当我们点击奇数行时,它会显示偶数行,并向下滑动每行的li内容.我需要帮助,当我再次点击li标签时,我想要它,但它也应该隐藏行.这应该是在向上滑动后调用行上的隐藏功能.
解决方法
$(document).ready(function () { $("#newrecord tr:odd").addClass("odd"); $("#newrecord tr:not(.odd)").find("li").hide(); $("#newrecord tr:not(.odd)").hide(); $("#newrecord tr:first-child").show(); $("#newrecord tr.odd").click(function () { $("#newrecord tr:not(.odd)").show(); $(this).next("tr").find("li").slideToggle("slow","swing",function(){ //What to do on toggle compelte... }); }); });