I have multipage jQuery Mobile app. First page contains container div with number of child divs, which can be scrolled programmatically using.scrollLeft(...). Now when user navigates to second page and want to go back to first page, I need to scroll container programmatically before he can see first page. This doesn't happen, because containerscrollWidthis 0, while the page with that container is not an active page. Question - how to scroll divs in inactive page from code?
(I've used this plugin, and made some contributions to the code in the past.)
It walks up the node tree from any given node, unhiding any hidden elements. It gets the dimensions, then sets nodes that were unhidden back to their original state.
This causes no visible effect, because rendering does not take place while a JS function is executing. On the next render cycle, nothing will have changed, and so there is no "flash" from the unhidden nodes.
However, for jQuery Mobile pages, there is a shortcut, so long as it is only a <div data-role='page'> that is hidden. (That is, there is no containing element WITHIN the hidden page that is itself hidden.)
So, you can simply change the page div to display:block, retrieve whatever dimensions you are interested in, and then change the page div back to display:none.