我正在創建一個表,我想突出顯示特定的行。用動畫去除css類
我這樣做是使用:
$this.css('background-color', 'green');
$this.delay(3000).animate({ backgroundColor: $color }, 3000);
$this = the row in question.
$color = the previous row color.
但我想它與一個CSS類工作,所以像這樣
$this.addClass('highlight');
類.highlight
只會有一個background-color
。
問題是,我添加類後,我不能background-color
。
如果我使用:
$this.delay(3000).animate({ backgroundColor: $color }, 3000);
它似乎並沒有工作,因爲它沒有覆蓋類.highlight本身的background-color
財產。 而我沒有看到一種方法來動畫removeClass
方法,甚至switchClass
從.highlight
到''
。
有沒有什麼解決方案,我不想做這個。
在此先感謝。
這可以幫助:HTTP:/ /stackoverflow.com/questions/7302824/animating-addclass-removeclass-with-jquery –