Vandzelyak / iscroll-js

Automatically exported from code.google.com/p/iscroll-js
MIT License
0 stars 0 forks source link

Scroller position problem after focus change over input tags inside. #78

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have a scroller wrapper and a scroller inside. In the scroller there is a 
form with some input elements. Scroller's height is 500px, wrapper's height is 
200px. Vertical scrolling is good.

If I move the focus over input elements, this operation seems moving scroller 
up correctly. But, at the end of the form, I can't touch-scroll the scroller up.

It seems like the focus move does't update the position variables inside 
iScroll object: so, when the focus reaches the last input element, i can 
touch-scroll the scroller down (on an empty area) but can't reach the input 
elements the high part of form.

Please help. Thank you!

Original issue reported on code.google.com by gianfras...@gmail.com on 21 Sep 2012 at 9:39

GoogleCodeExporter commented 8 years ago
I temporary solved using a workaround: on every focus change, I make move the 
scroller in the way the focused element never exits the visible area.

You can take a look at my code, commands i call on the onReady event of the 
page:

<code>
$('#scroller-wrapper input, #scroller-wrapper select').focusin(function() {
    scroller_object.scrollToElement('#' + $(this).attr('id'), 0);
});

setTimeout(function () {
    scroller_object.refresh();
}, 100);
</code>

Original comment by gianfras...@gmail.com on 21 Sep 2012 at 11:45