Transition to the same page #2529
Comments
The main issue with allowing transitioning to the same page is the actual transition animations themselves. They usually require 2 different elements to operate on. That said, we were thinking of disabling the same page check in changePage() via a config option, whose default could be tweaked to turn off. The caveat would be that you would be responsible for either turning off transitions when going to the same page or defining your own transition that makes sense. |
Well that sounds reasonable. Although it's difficult to appreciate without a Currently my software team is having to create new DOM elements instead of
If you'd like an example of our approach, let me know and I can provide a Finally, many thanks for your quick and prompt response! On 26 September 2011 17:38, Kin Blas <
|
Landed a fix on the HEAD: To allow same page transitions, you will have to change the default config option:
or pass it in as an option to your manual call to changePage():
This is the last item I think Jive needed. |
I tried this out with the latest jQuery Mobile build and it doesn't seem to It transitions to a blank screen. According to the Google Chrome Elements On 26 September 2011 18:29, Kin Blas <
|
Sorry 'bout that, it's fixed now on the HEAD: |
OK I'll give it another go. FYI. I managed to get some of it working earlier by not using transitions.
|
- So it seems just allowing changePage() to process same toPage and fromPage is not enough. I modified the CSS3 keyframe animation plugin so that it only removes the ui-page-active class from the fromPage if it is *NOT* the same as the toPage. - I also re-ordered the in/out transition rules for forward/reverse transitions so that the user always views some sort of animation/motion.
I've been testing your change and it works great. Many thanks for your help, On 28 September 2011 17:21, Kin Blas <
|
You're welcome. :-) |
Hi I am using JQM 1.0 with latest Backbone.js and I experience the same kind of issue. I have allowSamePageTransition=true, and I call manually the showPage method from the render method of my Backbone views. Thanks ! |
@davidlevy did you find any resolution to this? I'm facing the same issue. While I'm VERY grateful that there is a way to transition to the same page, the blank page you mention is a very bad user experience. I'm using plain old JQM and HTML, seeing exact same issue. Anyone know of a fix for this? |
@jjstafford , no did not find any fix for this. I disabled transitions in these cases for now. :( |
@davidlevy yeah, I assumed that would be the case. I ended up cloning the "to" page with a bunch of temp IDs, then removing the from page and re-naming everything back on pageshow. Not what I wanted to spend a day on, but it works. I just couldn't bear not having the transition. Thanks for the reply! |
I just ran in to this little bugaboo and to solve it, immediately after calling $.mobile.changePage, I bind to the CSS animation complete callback to enable the page again: $.mobile.changePage($page, options);
$page.animationComplete(function () {
$page.addClass('ui-page-active');
}); Because the animations are set to 200-350ms (roughly) in the CSS, the bind should be queued up and fired after all the magic that $.mobile.changePage sets up in terms of transition callbacks. This feels kind of hacky, but allows me a much easier way of 'transitioning' to the same page in the DOM in that I don't have to dynamically create pages in the DOM and worry about history and all that. Thoughts? |
@eculver : just tested it and it works indeed (with JQM 1.1.0) ! Though, it does blink in some pages, seems to be related to my fixed positioning header |
@eculver @davidlevy I am also trying to get this fix to work. it doesnt blink for me but the position of the listview is shifted up. It seems to not recognize that there is a header. |
i'm on JQM 1.1 and i'm getting this when trying to changePage to the same page: jquery.mobile-1.1.0.js:2815 Uncaught TypeError: Cannot call method '_trigger' of undefined When I call: function showQuestion(question_id, customTransition, reverseTransition)
} The function works just fine when i'm not on question_show.html but when I am, it bombs with the above error. Thoughts? |
I am having the same issue as wiltontilt I'm on jQM 1.1 I am transitioning to the same page (to a new dataset). All other transitions work perfect (dozens). But this on gives either a blanc page or does not transition to the next page (dataset)
Both on line 43 of jquery.mobile.js (compressed). If I then refresh the page, it shows correctly. Now what really gets me is that this behavior does not occur every time. I have spent hours trying to find a way to get this working and several times I thought I had it working but - bang - all of a sudden here comes the error. O.k., I got it now: The error occurs when I transition from a page that has a data-url value that represents its url. So I check the data-url and choose window.open instead of changePage when data-url is a path: if ( This is a bad hack and it is a bad user experience but it works. |
I'm having an issue using the back button after transitioning to the same page. The url (including hash) updates correctly to the page prior to the one that was reloaded, but no transition is made to this prior page. |
@mgm8870 I'm having the same issue as you, after the transition the page is still shifted up. Were you able to resolve this? |
@dpeacock No I didn't... I since scrapped the idea of doing that and alternate between two identical page templates, A.html and B.html |
If you only need to refresh the page (like reloading a normal non-ajax one), use an empty form with no action, and submit it. It will effectively reload the page with the same animation that all your pages load. |
Having the same problem as @wiltontilt, having to code an awful hack made even more awful by the fact that it collides with my hacks for jquery mobile's other glaring mistakes like broken history and no querystring support. This framework is just one emergency solution after the next. |
the problem still persists |
It would be extremely useful to be able to transition to the same page for applications that dynamically produce their own content.
For example, let's take jQuery Mobile's own dynamic page creation demo...
http://jquerymobile.com/test/docs/pages/dynamic-samples/sample-reuse-page.html
Now let's say the data structure generating this content was 10 x deep. Or potentially without depth. It would be really nice
to hyperlink to the same page (with a different hash of course) so the DOM wasn't need to be constantly added too.
The text was updated successfully, but these errors were encountered: