我已經在使用插件來處理CSS3屬性。它在點擊時起作用,並旋轉45度,但當再次點擊隱藏內容時,它不會旋轉回來。關於如何使這項工作的任何想法?使用jQuery來切換CSS旋轉
$("#faq dt").click(function() {
$(this).next('dd').slideToggle('fast');
if ($(this).next('dd').is(':visible')) {
$(this).children('span').transition({ rotate: '45deg' });
}
else {
$(this).children('span').transition({ rotate: '-45deg' });
}
});
您可以查看活動站點位置:http://www.revival.tv/lastdays/
工作片斷:
$("#faq dt").click(function() {
$(this).next('dd').slideToggle('fast', function() {
if ($(this).is(':visible')) {
$(this).prev('dt').children('span').transition({ rotate: '45deg' });
} else {
$(this).prev('dt').children('span').transition({ rotate: '0deg' });
}
});
});
我認爲你應該使用'是( ':可見')'後'toggle'動畫 –