iScroll is disabled when content is shorter than window size

181 views Asked by At

I am using iscroll-probe.js to implement the pull-to-refresh and infinite load in a Phonegap application using the example given in this link.

I am loading the contents dynamically so iscroll is refreshed after the list items have been added. Everything works perfectly for me except the situation when the total height of the list items is lesser than the screen height.

This is when the scroller is not required hence is disabled but it also disables the pull-to-refresh. This I think is how iscroll works as the scroller is disabled the moment I call the refresh method.

Does anyone know how to make pull-to-refresh work when the content height is smaller than the screen height.

1

There are 1 answers

0
Franz On

For anyone still interested, I solved this problem by setting a min-height to the #scroller element.

I did this using jquery (I'm not sure if it can be done by using css only).

$('#scroller').css('min-height',($(window).height()+1)+'px');

That is: the #scroller element min-height is set to the window height + 1px. This way the scroller is always enabled.

Please note that this instruction has to be executed before instantiating the iScroll element.