Jquery – iScroll Reset function

jqueryscroll

I am using iScroll to ensure compatibility of our admin area. The documentation lists what to do if you load in a page via ajax to reset the scroll area but I cannot get it to work.

documentation is here : http://cubiq.org/iscroll-4 just over a third of the way down 'mastering the refresh'

The documents uses myscroll as a variable. I have implemented something similar and it is working as it works out where the content is but does not reset the scroller thus one cannot see content loaded in via ajax that is larger than the initial.

Can anyone work it out.

Many Thanks,

Best Answer

You say that this is not working?

setTimeout(function () {
    myScroll.refresh();
}, 0);

Are you using jQuery .load or .ajax to load the new content?

For ajax, put as option, dataType: 'html' to ensure it will run any script inside tag that will come with the data you loaded.

Then, put at the end of your loaded document:

<script type="text/javascript">
$(document).ready(function() {
    setTimeout(function() {
        myScroll.refresh();
    }, 0);
});
</script>

(considering you are using jQuery).

Remember that myScroll and myscroll are two different things since its case-sensitive. Re-check your myscroll name.

Anyways, that works for me.

Related Topic