frequent
frequent

Reputation: 28493

jquery-mobile - prevent scrolltop on loading a new page into the DOM?

I want to override Jquery Mobile scrolling to the top of the screen on changing a page.

There are two transitions I need to tweak:
a) transitions between two pages already existing in the DOM (see Jquery Mobile RC2.js line #2440)
b) transitions when a new page is added to the DOM

I'm halfway done: You can block (a) by overriding the 4 scrollTo() following after line #2440.

Question:
Which section in JQM.js do I need to tweak when I want to override ScrollTo when a new page is loaded? Just can't find it.

Thanks for help!

Upvotes: 1

Views: 2561

Answers (1)

Phill Pafford
Phill Pafford

Reputation: 85298

jQM offers $.mobile.silentScroll

Scroll to a particular Y position without triggering scroll event listeners.

  • Arguments: yPos (number, defaults to 0).

Pass any number to scroll to that Y location.

Examples:

//scroll to Y 100px             
$.mobile.silentScroll(100);

Upvotes: 2

Related Questions