jQuery UI自动完成(1.8)滚动 [英] JQuery UI Autocomplete (1.8) scroll

查看:109
本文介绍了jQuery UI自动完成(1.8)滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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-1.8.16.css中,我已对此进行了设置:
  • in the jquery-ui-1.8.16.css i've set this:
ui.autocomplete{
    max-height: 100px;
    overflow-y: auto;
    overflow-x: hidden;
}

*如用户界面文档示例

这就是我声明和自动完成输入的方式:

This is how i declare and autocomplete input:

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

我不知道为什么滚动条不出现,任何帮助将不胜感激.非常感谢你!

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

推荐答案

您应该在这样的页面中覆盖css设置

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

<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>

而不是更改jquery-ui-1.8.16.css

这篇关于jQuery UI自动完成(1.8)滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆