我有一些基本的jQuery来切换按钮中的文本以及在两个div之间切换。问题是,传入的元素在传出的元素消失之前出现,然后传入的元素在动画结束时向上滑动。它看起来有点生气。这里是my fiddle。jQuery fadeToggle在传出被隐藏之前显示传入元素
对于后人,这里是我的html:
<button id='globalTicketsBtn'>Show Table</button>
<div class="toggle" id="globalTicketsByHour">This is where the chart will be</div>
<div class="toggle" style="display: none">This is where the table will be</div>
而且我的jQuery:
$("#globalTicketsBtn").click(function() {
$(".toggle").fadeToggle(function() {
$('#globalTicketsBtn').text($(this).is(':visible')? 'Show Chart' : 'Show Table');
});
});
我应该开火动画顺序连续而不是一个单一的fadeToggle?
感谢您的任何建议!
对你很简单,也许:)。完善。太感谢了! – Matt
哈哈我想。 XD不客气:)高兴地帮忙。 –