有沒有辦法可以讓animate()的回調(diào)函數(shù)先于動畫執(zhí)行?或者有沒有什么方法可以實(shí)現(xiàn)類似的功能呢?想讓下面代碼在執(zhí)行完回調(diào)函數(shù)內(nèi)的方法之后再執(zhí)行動畫里的width:'0';if?(!$(this).hasClass('section3'))?{
????$(this).stop().animate({
????????width:'0'
????},1500,function(){
????????//回調(diào)函數(shù)隱藏按鈕
????????//所有和翻頁有關(guān)的動畫都應(yīng)寫于此處
????????let?sectionNum=$(this).attr('class').substring(15,)
????????console.log(sectionNum);
????????switch?(sectionNum){
????????????case?'1':
????????????????$('.btnChange').fadeOut();
????????????????break;
????????????case?'2':
????????????????break;
????????????case?'3':
????????????????break;
????????????default:
????????????????break;
????????}
????})
}
關(guān)于jq的animate()方法
ZagO
2018-05-26 15:32:33