老師,判斷動畫在執行中用 .is(":animated") 是不是更好些?
this.nextBtn.click(function(){
????????????if(?!self.posterItem.is(":animated")?){
????????????????self.carouselRotate("left");
????????????}??????????
????????});
????????this.prevBtn.click(function(){
????????????if(?!self.posterItem.is(":animated")?){
????????????????self.carouselRotate("right");
????????????}??
????????})
2015-11-12
當然可以,不能說更好,這樣的話的jq會查詢每一個posterItem是否動畫結束,我寫那樣只要動畫結束就一個標識,不用判斷多次,jq雖然有相應的功能,但不要隨便用,要注意性能哦