jquery-archive / jquery-mobile

jQuery Mobile Framework
https://jquerymobile.com
Other
9.69k stars 2.4k forks source link

Docs: allowSamePageTransition #3968

Closed linocastrovilli closed 12 years ago

linocastrovilli commented 12 years ago

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 commented 12 years ago

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

PauloAlmeida commented 12 years ago

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 commented 12 years ago

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 commented 12 years ago

@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 commented 12 years ago

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 commented 12 years ago

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 commented 12 years ago

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