现在此下拉层高度是自适应,有多少数据就列多长。想怎么设置高度,让多余的数据用滚动跳查看。
2条回答 默认 最新
- canyoufeel75 2012-04-10 17:20关注
给你找的源码 有这个效果的 max-height
<!DOCTYPE html>
jQuery UI Autocomplete - Scrollable results
<br> .ui-autocomplete {<br> max-height: 100px;<br> overflow-y: auto;<br> /* prevent horizontal scrollbar <em>/<br> overflow-x: hidden;<br> /</em> add padding to account for vertical scrollbar <em>/<br> padding-right: 20px;<br> }<br> /</em> IE 6 doesn't support max-height<br> * we use height instead, but this forces the menu to always be this tall<br> */<br> * html .ui-autocomplete {<br> height: 100px;<br> }<br>
<br> $(function() {<br> var availableTags = [<br> "ActionScript",<br> "AppleScript",<br> "Asp",<br> "BASIC",<br> "C",<br> "C++",<br> "Clojure",<br> "COBOL",<br> "ColdFusion",<br> "Erlang",<br> "Fortran",<br> "Groovy",<br> "Haskell",<br> "Java",<br> "JavaScript",<br> "Lisp",<br> "Perl",<br> "PHP",<br> "Python",<br> "Ruby",<br> "Scala",<br> "Scheme"<br> ];<br> $( "#tags" ).autocomplete({<br> source: availableTags<br> });<br> });<br>Tags:When displaying a long list of options, you can simply set the max-height for the autocomplete menu to prevent the menu from growing too large. Try typing "a" or "s" above to get a long list of results that you can scroll through.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
- ¥15 Vue3地图和异步函数使用
- ¥15 C++ yoloV5改写遇到的问题
- ¥20 win11修改中文用户名路径
- ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
- ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
- ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
- ¥15 帮我写一个c++工程
- ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
- ¥15 关于smbclient 库的使用