当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


jQWidgets jqxDropDownList dropDownHorizontalAlignment属性用法及代码示例


简介:jQWidgets 是一个 JavaScript 框架,用于为 PC 和移动设备制作基于 Web 的应用程序。它是一个非常强大、经过优化、与平台无关且得到广泛支持的框架。 jqxDropDownList 小部件是一个 jQuery 下拉列表,其中包含显示在下拉列表中的可选项目列表。

dropDownHorizo​​ntalAlignment 属性用于设置或返回 DropDown 的对齐方式。它接受 String 类型的值,默认值为 ‘left’。

它的可能值是 -

  • ‘left’
  • ‘right’


用法:

设置 dropDownHorizo​​ntalAlignment 属性。

$('selector').jqxDropDownList({ dropDownHorizontalAlignment:String });

返回 dropDownHorizo​​ntalAlignment 属性。

var DDHA = $('selector').jqxDropDownList('dropDownHorizontalAlignment');

链接文件:从链接 https://www.jqwidgets.com/download/下载 jQWidgets。在 HTML 文件中,找到下载文件夹中的脚本文件。

<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” />
<link rel=”stylesheet” href=”jqwidgets/styles/jqx.energyblue.css”>
<script type=”text/javascript” src=”scripts/jquery-1.11.1.min.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqx-all.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxbuttons.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxscrollbar.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxlistbox.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxdropdownlist.js”></script>

下面的示例说明了 jQWidgets 中的 jqxDropDownList dropDownHorizo​​ntalAlignment 属性。

例:

HTML


<!DOCTYPE html>
<html lang="en">
  
<head>
    <link rel="stylesheet" href=
        "jqwidgets/styles/jqx.base.css" type="text/css" />
    <link rel="stylesheet" href=
        "jqwidgets/styles/jqx.energyblue.css">
    <script type="text/javascript" 
        src="scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqx-all.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqxdropdownlist.js"></script>
</head>
  
<body>
    <center>
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
  
        <h3>
            jQWidgets jqxDropDownList dropDownHorizontalAlignment Property
        </h3>
  
        <div id='jqxDDL'></div>
    </center>
    <script type="text/javascript">
        $(document).ready(function() {
            var data = [
                "Computer Science",
                "C Programming",
                "C++ Programming",
                "Java Programming",
                "Python Programming",
                "HTML",
                "CSS",
                "JavaScript",
                "jQuery",
                "PHP",
                "Bootstrap"
            ];
  
            $("#jqxDDL").jqxDropDownList({
                source:data,
                theme:'energyblue',
                dropDownWidth:250,
                dropDownHorizontalAlignment:'left'
            });
        });
    </script>
</body>
  
</html>

输出:

参考: https://www.jqwidgets.com/jquery-widgets-documentation/documentation//jquery-dropdownlist-api.htm




相关用法


注:本文由纯净天空筛选整理自ppatelkap大神的英文原创作品 jQWidgets jqxDropDownList dropDownHorizontalAlignment Property。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。