Jquery autocomplete with iScroll

我们两清 提交于 2019-12-11 20:08:25

问题


I am using jQuery Autocomplete on my jQUeryMobile application. It works perfectly. Now I'm trying to use iScroll.js to scroll through the list of looked up items. Here is what I am doing,

The problem is that iscroll is applying only for the first item of the suggestion box, where as I'm not able to scroll through entire list .Please help me if I'm missing anything in my code. Please help me to acheive this using iScoll.

I found one more way that we can use custom touch based scrollbar for autocomplete box but there is a issue that the custom scrollbar appears only for first search and it disappears from the suggastion box when list get refreshed, How can I fix this, because both options are fine for me for using my autocomplete in ipad and android.

If anyone thinks there's a better way to do this than with iScroll and jScrollPane I'm open to suggestions.


回答1:


i'd suggest to abort the iScroll approach and use plain CSS for this:

.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;
}

later on, if you insist, you can assign custom scrollbars with a little help from the many libraries out there created for that purpose.

Note: the CSS snippet is ported from the official jQuery UI AutoComplete reference.



来源:https://stackoverflow.com/questions/10878883/jquery-autocomplete-with-iscroll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!