Reputation: 4417
I found JS ready to use a scroll bar in Mobile this site: http://cubiq.org/iscroll-4
My list is filled with autocomplete in input ..
Takes a few minutes to scroll bar appears.(Sometimes displays after several minutes and sometimes not displayed at all)
until it appears when I try to drag down, the list jumps up
anyone have any idea why this is happening?
My JS:
myScroll = new iScroll('wrapper');// **in Document.ready**
My HTML:
<div id="wrapper">
<ul class="Result" data-role="listview" data-inset="true" dir="rtl">
</ul>
</div>
My css:
#wrapper
{
z-index: 5000;
width: 30%;
position: absolute;
margin-left: 37%;
}
Upvotes: 1
Views: 351
Reputation: 4417
Finally I solved the problem this way:
Need to refresh the scroll each time the size of the list changes
Because it takes time for AutoComplete to fill, I refresh the scroll only after some time.
function on key press in the input:
function RefreshScroll() {
setTimeout(function () {
MyScroll.scrollToElement('li:nth-child(1)', 100)
setTimeout(function () {
MyScroll.refresh();
}, 0);
}, 200);
}
Upvotes: 0
Reputation: 32949
Try this maybe:
myScroll = new iScroll('wrapper', {fadeScrollbar: false});
Upvotes: 1