當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


jQWidgets jqxNavigationBar animationType屬性用法及代碼示例


jQWidgets是一個 JavaScript 框架,用於為 PC 和移動設備製作基於 Web 的應用程序。它是一個非常強大、優化、獨立於平台且得到廣泛支持的框架。這jqxNavigationBar用於表示具有標題和內容部分的 jQuery 小部件。單擊標題時,內容將相應地展開或折疊。

動畫類型屬性用於設置或獲取指定jqxNavigationBar的動畫類型。此方法具有三個可能的值:‘slide’, ‘fade’ 和‘none’。

用法:

  • 用於設置動畫類型屬性:

    $('Selector').jqxNavigationBar({
        animationType: "slide" 
    });  
  • 為了得到動畫類型屬性:

    var animationType = 
        $('Selector').jqxNavigationBar('animationType');

鏈接文件:下載jQWidgets從給定的鏈接。在 HTML 文件中,找到下載文件夾中的腳本文件。

<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”scripts/jquery.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxexpander.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxnavigationbar.js”></script>

例子:下麵的示例說明了 jQWidgets jqxNavigationBar動畫類型屬性。在下麵的示例中,值動畫類型屬性已設置為‘slide’。

HTML


<!DOCTYPE html> 
<html lang="en"> 
  
<head> 
    <link rel="stylesheet" 
          href="jqwidgets/styles/jqx.base.css"
          type="text/css"/> 
    <script type="text/javascript" 
            src="scripts/jquery.js"> 
    </script> 
    <script type="text/javascript" 
            src="jqwidgets/jqxcore.js"> 
    </script> 
    <script type="text/javascript" 
            src="jqwidgets/jqxexpander.js"> 
    </script> 
    <script type="text/javascript" 
            src="jqwidgets/jqxnavigationbar.js"> 
    </script> 
</head> 
  
<body> 
    <center> 
        <h1 style="color: green;"> 
            GeeksforGeeks 
        </h1> 
        <h3> 
            jQWidgets jqxNavigationBar animationType Property 
        </h3> 
        <div id="jqx_Navigation_Bar" style="margin: 25px;" 
             align="left"> 
            <div>First Header</div> 
            <div> 
                <h8>Content for the first header</h8> 
                <ul> 
                    <li>GFG</li> 
                    <li>CSE</li> 
                </ul> 
            </div> 
            <div> Second Header</div> 
            <div> 
                <h8>Content for the second header</h8> 
                <ul> 
                    <li>GeeksforGeeks</li> 
                    <li>CSE</li> 
                </ul> 
            </div> 
        </div> 
        <input type="button" style="margin: 29px;" 
               id="jqxbutton_for_animationType"
               value="Value of the animationType property"/> 
        <div id="log"></div> 
        <script type="text/javascript"> 
            $(document).ready(function () { 
                $("#jqx_Navigation_Bar"). 
                    jqxNavigationBar({ 
                        width: 290, 
                        height: 150, 
                        animationType: "slide" 
                    }); 
                $("#jqxbutton_for_animationType"). 
                    jqxButton({ 
                        width: 250, 
                    }); 
                $('#jqxbutton_for_animationType'). 
                    on('click', function () { 
                        var value_of_AnimationType =  
                            $('#jqx_Navigation_Bar'). 
                            jqxNavigationBar( 
                                'animationType'); 
                        $("#log").html(JSON.stringify( 
                            value_of_AnimationType)) 
                    }); 
            }); 
        </script> 
    </center> 
</body> 
  
</html>

輸出:

參考: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxnavigationbar/jquery-navigationbar-api.htm?search=



相關用法


注:本文由純淨天空篩選整理自Kanchan_Ray大神的英文原創作品 jQWidgets jqxNavigationBar animationType Property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。