jQuery UI Autocomplete控件下拉列表固定高度
来源:互联网 发布:windows安装jdk 编辑:程序博客网 时间:2024/05/22 13:32
jQuery ui Autocomplete控件下拉列表高度默认是自适应的,有多少数据就会加载出来多少行。以下是给下拉列表设置一个默认高度并添加滚动条的解决办法。
- 在样式里添加以下代码
.ui-autocomplete { max-height: 150px; //默认最大高度150像素 overflow-y: auto; //添加滚动条 /* prevent horizontal scrollbar */ overflow-x: hidden; } /* IE 6 doesn't support max-height * we use height instead, but this forces the menu to always be this tall */ * html .ui-autocomplete { height: 150px; //解决IE6下不识别max-height }
- 官方源码[http://jqueryui.com/autocomplete/#maxheight ]
<!doctype html><html lang="en"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>jQuery UI Autocomplete - Scrollable results</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <link rel="stylesheet" href="/resources/demos/style.css"> <style> .ui-autocomplete { max-height: 150px; //默认最大高度150像素 overflow-y: auto; //添加滚动条 /* prevent horizontal scrollbar */ overflow-x: hidden; } /* IE 6 doesn't support max-height * we use height instead, but this forces the menu to always be this tall */ * html .ui-autocomplete { height: 150px; //解决IE6下不识别max-height } </style> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script> $( function() { var availableTags = [ "ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ]; $( "#tags" ).autocomplete({ source: availableTags }); } ); </script></head><body> <div class="ui-widget"> <label for="tags">Tags: </label> <input id="tags"> </div></body></html>
1 0
- jQuery UI Autocomplete控件下拉列表固定高度
- 关于jQuery UI中的autocomplete控件
- 在jquery ui dialog里面的autocomplete和chosen插件的下拉列表被覆盖的解决方法
- 下拉列表autoComplete
- jQuery ui autocomplete实现联想输入下拉菜单
- jquery UI autocomplete获得焦点自动弹出跟随下拉框
- jquery bootstrap下拉列表设置最大高度
- JQUERY UI autocomplete
- jquery ui autocomplete
- 使用 jQuery UI AutoComplete
- jQuery UI AutoComplete
- jQuery UI Autocomplete 体验
- jQuery UI Autocomplete 体验
- jquery ui autocomplete实例
- JQuery UI Autocomplete
- jQuery UI Autocomplete
- jquery ui autocomplete自动提示控件使用示例
- Android UI控件之Spinner(下拉列表)
- CAFFE源码学习笔记之内积层-inner_product_layer
- jobHandler调度管理
- Chrome 56 扩展开发实验03:跨域 XMLHttpRequest 请求
- c和C++混合编译
- cas4.2.x 自定义登录页面
- jQuery UI Autocomplete控件下拉列表固定高度
- /includes/lib_base.php on line 346 Ecshop出现问题
- 从分布式一致性谈到CAP理论、BASE理论
- volley 缓存清理不干净
- java基础知识点
- 老生常谈,正确使用memset
- 关于ORA-00979 不是 GROUP BY 表达式错误的解释:
- 正则表达式在linux中的应用
- [BZOJ 4815] [Cqoi2017]小Q的表格 解题报告