Search code examples
jquery-mobilecordovaiscroll4

How to dynamic loade pages and using IScroll


I am using IScroll to help position a footer in the bottom of the screen on my PhoneGap application, but I have a problem I have struggling with for a few nights, so I hope some of you might be able to help.

To be able to persist my header and footer through the application I have been using something similar to this.

Usually I would bind on my PageCreated event, but since this is not execute I can't do that. I have tried after the page is received and I have called jQuery('#mobilePage').trigger('create'); to call setTimeout(function(){ myScroll.refresh(); },0);.

The issue is that the height isn't generated correctly. Half of the time some of the content is hidden beneath the footer.

My theory is that trigger('create') takes som time to call, and I therefore call myScroll.refresh() too early.

My question is there if there is a way to bind up on the trigger('create') event so I can create a callback and execute the scroll update?


Solution

  • in iscroll code, check for

    checkDOMChanges
    

    and make it true. then iscroll will handle setting up of the refresh whenever dom changes