.toggleClass( className )
classNameOne or more class names (separated by spaces) to be
toggled for each element in the matched set.
className可以設定一個或多個css類別(用空白鍵隔開),對
被選取的元素切換css類別。
這個方法採用一個或多個css名作為其參數
ex 這個div擁有一個tumble的class
Some text.
The first time we apply $(‘div.tumble’).toggleClass(‘bounce’), we get the following
當我們用這個方法切換bounce的class時,可以得到這個結果
Some text.
The second time we apply $(‘div.tumble’).toggleClass(‘bounce’), the
class is returned to
the single tumble value:
第二次當我們又toggleClass(‘bounce’)時,原
本已經擁有bounce的div將會被拿掉bounce
Some text.