javascript - jQueryMobile - Scroll to a position onLoad -


In jQueryMobile, on page load, I want to scroll to a given position. I know how to do this in classic jQuery, but there is an auto-scroll top on page load in jQueryMobile.

I tried to:

  $ (document) .ready (function () {$ .mobile.silentScroll (1000);});  

This does not work My page remains blocked at the top of the page.

However, if I click on the link with "code" onclick = "$. Mobile.silentScroll (1000)" " then works perfectly!

< P> I want to scroll to page load on yposition!

======= Edit ============ After the suggestions of White Raven and Omar, I Trying to do this:

  $ (document) .delegate ("# pagePkmn", "pageinit", function () {$ .mobile.silentScroll (1000);}); < / Code> 

or this:

  $ (document) .one ("Page Container Show", function () {$ .mobile.silentScroll (1000);} );  

But still no effect ...

Thanks for your attention.

pageinit is recommended.

=== EDIT ===

You can always use the ghetto:

  setTimeout (function () {$. Mobile.silentScroll (1000);}, 1000); // scroll to 1 second  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -