Is it possible to set a scrollTop on a page before the page is shown, on
mobile?
I have no code for this, as this is more of a concept question.
I have a jquery mobile page that has a section at the top of its content
that I want to place above the viewport. What i've done is set a
silentscroll that is equivalent to the height of this section, which makes
the window scroll to just below the section i want hidden.
The problem I have right now is that between when the page is loaded and
shown to when the silentscroll is thrown, there is a split second of being
able to see the section to be hidden, which makes the page look buggy
given that you can see the silentscroll jump by 100-sum pixels to hide the
section. This is clearly because the silentscroll is execute after the
page is shown.
Is there a way to set a scrollTop to jquery mobile for it to be executed
before the page is shown, preferably around when the pagebeforeshow event
is thrown? As far as I know, this event is thrown after all the jquery
mobile widgets are initialized, so couldn't the scrollTop be set on the
window at this time?
What I'm trying to do is set the scrollTop value on the window before the
page is shown, so that the user doesn't have to see the page jump.
I haven't been able to correctly set it up myself, I'm wondering if it's
event possible.
Here's a quick image of the setup i'm trying to recreate. The green square
is the section I want 'hidden', above the window. The blue box represents
the mobile window and the grey box represents the document.
EDIT: I've checked mobile browsers; safari has no jump/jitter when it
corrects for the silentscroll. Chrome mobile on IOS does have the
jump/jitter, I wonder if it's a question of browser performance, or the
way it queues DOM/viewport changes...
No comments:
Post a Comment