-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Refactor: changepage outline
changepage:
arguments:
-
to: page you're changing to types:
- string: page url or id - object: jquery element or form object containing {url, data, type} - array: defines from and to (allows you to transition from a different page than current - deprecate?)
-
transition: which transition class to use (defaults to global default transition)
-
direction: forward/reverse
-
changeHash: update the hash on complete?
-
fromHashChange: changePage came from hashchange event
-
determine type of "to" arg (one call to $.type(to) is best)
-
try to determine "from" page: should either be active page, or first item of "to" if it's an array
-
if to is a string, strip the leading #
-
define fileURL as the request URL minus any internal params at the end
-
Attempt to guess whether it's a back/forward
-
reset base url to match new page before request goes out
-
define functions to be used once page is available
-
enhancePage
-
pageTransitionLock
-
transitionPages
- addContainerClass
- removeContainerClass
-
changePageComplete
-
8 . figure out of page is local or needs to be requested, get page either way - if ajax, call pageLoading to show the loader - call page plugin to enhance page - see if url pointed at a subpage, if so, change "to" to reference that
-
transitionPages procedure:
- get current scroll position
- scroll to top
- add container classes for 3d transition, if needed
- if there's a from page, set data on it for current scroll
- trigger pagebeforehide on from page
- trigger pagebeforeshow on to page
- call $.mobile.pageLoading( true ); to kill the page loader
- if there's a transition set, call