i'm having troubles configuring the autocomplete module of JQuery-UI. I need that when the amount of data to select is big enough an scroll bar appears.

我在配置JQuery-UI的自动完成模块时遇到了麻烦。当要选择的数据量足够大时,就需要一个滚动条。

This is what i tried:

这就是我所尝试的:

  • in the jquery-ui-1.8.16.css i've setted this:
  • jquery-ui-1.8.16。css我设置:

ui.autocomplete{ max-height: 100px; overflow-y: auto; overflow-x: hidden; }

ui。自动完成{ max-height:100 px;overflow-y:汽车;overflow-x:隐藏;}

*as shown in the ui-documentation example

*如ui文档示例所示

This is how i declare and autocomplete input:

这是我如何声明和自动完成输入:

$("#myInput").autocomplete({ source: mySource, minLength: 0, });

$(" # myInput”)。自动完成({源:mySource, minLength: 0,});

I dont know why the scroll bar does not appear, any help would be appreciated. Thank you very much!

我不知道为什么滚动条没有出现,请帮忙。非常感谢!

1 个解决方案

#1


68

You should override the css setting it in the page like this

您应该重写css在页面中的设置,如下所示

<style>
.ui-autocomplete {
    max-height: 100px;
    overflow-y: auto;
    /* prevent horizontal scrollbar */
    overflow-x: hidden;
    /* add padding to account for vertical scrollbar */
    padding-right: 20px;
}
/* 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: 100px;
}
</style>

instead of changing values in jquery-ui-1.8.16.css

而不是在jquery-ui-1.8.16.css中更改值

更多相关文章

  1. day049--jQuery文档操作示例
  2. HTML+jQuery图片上传示例
  3. 经典炫酷的HTML5/jQuery动画应用示例及源码
  4. PHP实现WebSocket示例
  5. PHP的$ _GET和URL重写
  6. PHP基础示例:商品信息管理系统v1.1[转]
  7. 040-PHP使用闭包函数来进行父实例的变量自增,正确示例
  8. mysql锁机制之示例讲解
  9. MySQL 示例数据库sakila

随机推荐

  1. [Android]Android端ORM框架——RapidORM(
  2. iOS开发-Android 录制的mp4视频文件在IOS
  3. android与pc的故事
  4. 谈谈Android个人开发者的现状
  5. AndroidStudio快捷键设置2
  6. android activy加载
  7. Android(安卓)emulated sdcard
  8. Android内存溢出
  9. android 获得listview里的控件的id
  10. Android(安卓)按钮控制ViewPager左右翻页