<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # .toggleClass() Categories: [Effects](http://www.css88.com/jquery-ui-api/category/effects/ "View all posts in Effects") | [Effects Core](http://www.css88.com/jquery-ui-api/category/effects-core/ "View all posts in Effects Core") | [Method Overrides](http://www.css88.com/jquery-ui-api/category/overrides/ "View all posts in Method Overrides") ## .toggleClass( className [, switch ] [, duration ] [, easing ] [, complete ] )Returns: [jQuery](http://api.jquery.com/Types/#jQuery) **Description:** 為每一組匹配的元素添加或移除一個或多個樣式類,取決于當前元素是否存在該樣式類和switch參數。,而且所有改變的樣式以動畫的形式展示 * #### [.toggleClass( className [, switch ] [, duration ] [, easing ] [, complete ] )](#toggleClass-className-switch-duration-easing-complete) * **className**Type: [String](http://api.jquery.com/Types/#String)將要被添加到匹配的元素的class屬性的一個或多個名稱(以空格分開) 。 * **switch**Type: [Boolean](http://api.jquery.com/Types/#Boolean)一個決定是否添加或移除某css類的布爾值。 * **duration** (default: `400`)Type: [Number](http://api.jquery.com/Types/#Number) or [String](http://api.jquery.com/Types/#String)一個字符串或者數字決定動畫將運行多久。(愚人碼頭注:三種預定速度的字符串("slow", "normal", 或 "fast")或表示動畫時長的毫秒數值(如:1000) ) * **easing** (default: `swing`)Type: [String](http://api.jquery.com/Types/#String)一個字符串,表示過渡使用哪種 [緩動 函數](/easings/)。 * **complete**Type: [Function](http://api.jquery.com/Types/#Function)()在動畫完成時執行的函數。 * #### [.toggleClass( className [, switch ] [, options ] )](#toggleClass-className-switch-options) * **className**Type: [String](http://api.jquery.com/Types/#String)將要被添加到匹配的元素的class屬性的一個或多個名稱(以空格分開) 。 * **switch**Type: [Boolean](http://api.jquery.com/Types/#Boolean)一個決定是否添加或移除某css類的布爾值。 * **options**Type: [Object](http://api.jquery.com/Types/#Object)一組包含動畫選項的值的集合。所有屬性是可選擇的。 * **duration** (default: `400`)Type: [Number](http://api.jquery.com/Types/#Number) or [String](http://api.jquery.com/Types/#String)一個字符串或者數字決定動畫將運行多久。(譯者注:默認值: "normal", 三種預定速度的字符串("slow", "normal", 或 "fast")或表示動畫時長的毫秒數值(如:1000) ) * **easing** (default: `swing`)Type: [String](http://api.jquery.com/Types/#String)一個字符串,表示過渡使用哪種[緩動](/easings/) 函數。 * **complete**Type: [Function](http://api.jquery.com/Types/#Function)()在動畫完成時執行的函數。 * **children** (default: `false`)Type: [Boolean](http://api.jquery.com/Types/#Boolean)動畫是否應用到所有匹配的元素的后代元素。應慎使用此功能。 因為要確定哪些后代元素要應用動畫可能會非常好性能,而且 后代元素的數量是線性增長的。 * **queue** (default: `true`)Type: [Boolean](http://api.jquery.com/Types/#Boolean) or [String](http://api.jquery.com/Types/#String)一個布爾值,指示是否將動畫放置在效果隊列中。如果為false時,將立即開始動畫。 **從jQuery1.7開始**,隊列選項也可以接受一個字符串,在這種情況下, 在動畫被添加到由該字符串表示的隊列中。 類似原生CSS transitions(過渡), jQuery UI的樣式動畫提供了一個從一個狀態到另一個狀態平滑過渡, 同時讓你 保持那些CSS樣式改版的所有細節,和你的javaScript分離。 所有樣式動畫的方法,包括 `.toggleClass()` 支持自定義的持續時間(durations)和緩沖函數(easing),以及在動畫完成時提供一個回調。 并非所有的樣式都可以設置動畫。 例如,沒有辦法讓背景圖像應用動畫。不能進行動畫的樣式,將在動畫結束時被改變。 這個插件擴展了jQuery中的[`.toggleClass()`](http://api.jquery.com/toggleClass)方法。 如果沒有加載 jQuery UI,調用`.toggleClass()`方法可能不會失敗,因為方法仍然存在。 然而,預期的行為(愚人碼頭注:指平滑過渡動畫效果)將不會發生。 ## Example: #### 把類"big-blue"添加到匹配的元素 ``` <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>toggleClass demo</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"> <style> div { width: 100px; height: 100px; background-color: #ccc; } .big-blue { width: 200px; height: 200px; background-color: #00f; } </style> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> </head> <body> <div></div> <script> $( "div" ).click(function() { $( this ).toggleClass( "big-blue", 1000, "easeOutSine" ); }); </script> </body> </html> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看