问题
jQuery has a slideToggle
, and a fadeToggle
, but they don't play well together (see fiddle here):
$('div').on('click', function () {
$('span')
.slideToggle({duration: 'slow', queue: false})
.fadeToggle({duration: 'slow', queue: false});
});
How can I have slide
and fade
toggle at the same time?
回答1:
Use .animate()
as follows:
$('span').animate({
height: "toggle",
opacity: "toggle"
});
来源:https://stackoverflow.com/questions/14789388/jquery-toggle-both-slide-and-fade-animations-at-the-same-time