jQuery Mobile Framework

Navigation Search

Question:

How do I scroll to a position on a page?

Answer:

Since we use the URL hash to preserve Back button behavior, using page anchors to jump down to a position on the page isn't supported by using the traditional anchor link (#foo). This feature is slated for 1.4, but until then, you can use the silentScroll method to scroll to a particular Y position without triggering scroll event listeners. You can pass in a yPos argument to scroll to that Y location.

Here is an example of how to scroll to a position:


//scroll to Y 300px
$.mobile.silentScroll(300);
All Questions & Answers