Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Docs: allowSamePageTransition #3968

Closed
linocastrovilli opened this issue Apr 5, 2012 · 7 comments
Closed

Docs: allowSamePageTransition #3968

linocastrovilli opened this issue Apr 5, 2012 · 7 comments
Labels

Comments

@linocastrovilli
Copy link

Hi boys,
I use jQuery Mobile 1.0.1rc2 and I want to pass from the page x to the same page by the js method "changePage" with the attribute "allowSamePageTransition".

I don't know why, but the result is that the transition ends with an empty page.

Can someone help me??? thanks

@toddparker
Copy link
Contributor

Is this an issue with 1.0.1 final? If so, can you post a test page so we can review?

@PauloAlmeida
Copy link

By default, changePage() ignores requests to change to the current active page. Setting this option to true, allows the request to execute. Developers should note that some of the page transitions assume that the fromPage and toPage of a changePage request are different, so they may not animate as expected. Developers are responsible for either providing a proper transition, or turning it off for this specific case.

@toddparker
Copy link
Contributor

Thanks @PauloAlmeida for that summary. I'm going to close this as an issue because I never heard back re: specifics but I believe they are probably using a transition that doesn't work with this feature.

@agcolom or @uGoMobi - we should come up with a clear set of transitions that work with this and add a blurb about this feature and limitations on the transitions page.

@jaspermdegroot
Copy link
Contributor

@toddparker - If you don't mind I reopened and changed title and label to"docs".

@agcolom - I think the way @PauloAlmeida described it is very clear. With a little tweaking we can add that to the "Page transitions" page. Can you take care of that? I will look into the set of transitions that can be used for this.

@glennwidener
Copy link

Looking at the 1.1.0 final code, I don't think it always works as Paulo says. loadPage() is called before allowSamePageTransition is ever checked, so if you click on a self-referential link on a page, or otherwise call changePage(), and reloadPage is set (e.g. with a post), and if caching is off, the page is reloaded. Then if allowSamePageTransition is true, the remaining page fixup stuff is skipped, along with the transition, and some of this fixup may matter. This is probably wrong. Note also that the pagebeforechange and pagechange events are always fired.

@fspezi
Copy link

fspezi commented Jun 12, 2012

I resolved issue at the 1.1.0 final code, adding this code in line # 2189.

if ($from) $from = $from.not($to);

So, the code will appear in this way:

return function( name, reverse, $to, $from ) {
    // Xilium - Flavio Spezi - 2012-06-12
    // Solution for issue calling changePage when $to and $from are the same page: in end of transition the page is blank because removed as "$from" page.
    if ($from) $from = $from.not($to);

    var deferred = new $.Deferred(),
        reverseClass = reverse ? " reverse" : "",

I tested it with "slide" transition.

@jaspermdegroot
Copy link
Contributor

Closing this one as duplicate in favor of #4078 because that one has a team member assigned to it and is in review.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants