Quickly Build HTML5 and PhoneGap Mobile Apps

Using jQuery Swipe Transition For Navigation In Your Mobile App

Posted: November 3rd, 2011 | Author: | Filed under: Features | Tags: , , , | 15 Comments »

Navigating between pages in Tiggr is very simple. You first add an HTML event to a component, such as click for a button, and then add Navigate To Page action where you select the page to navigate:

This works very well, but it will replace the entire page. An alternative way to navigate or transition between pages is to use jQuery swipe transition which in my opinion looks better. Here is how to do it. You use the same event, such as click for a button. Then, we add Run Custom JavaScript action with the following code:

1
navigateTo('end', 's');

The first argument is the page name. The second argument indicates that a swipe transition should be done. That’s it. You are probably wondering why not do this via Navigate To Page action? It will be possible soon. We are going to add a check box so you will be able to select what type of transition you would like, a page replace or swipe. For now, this is a very simple work around.

Want to try it? Open this app on your device:

Or just scan this QR code:


15 Comments on “Using jQuery Swipe Transition For Navigation In Your Mobile App”

  1. 1 adam16ster said at 10:24 on January 6th, 2012:

    if thats a jquery function doesn’t it require the $ or jquery.navigateTo? i also can’t find navigateTo in any jquery or jquery mobile docs.

    im having trouble with this for back button functionality. its not animating properly. also, i’m losing all my data (from a rest call) navigating back to the previous screen. how can i save the state the data was in before clicking through?

  2. 2 adam16ster said at 10:31 on January 6th, 2012:

    ok i see that navigateTo is a tiggr api method but in the docs it doesn’t show that it accepts a transition parameter OR is it that tiggr’s navigateTo is the equivalent to setting the navigateTo action from the tiggr UI?

  3. 3 adam16ster said at 10:34 on January 6th, 2012:

    just to clarify my issues here are back button transition AND data disappearing when navigating away then back to screen that contained the data

  4. 4 max said at 10:49 on January 6th, 2012:

    @3adam16ster: yes, navigateTo() is Tiggr JS API (sorry, we are going update the API very soon). How are you going back to the page? Do you use a regular refresh or Ajax navigation?

  5. 5 adam16ster said at 10:58 on January 6th, 2012:

    i’ve tried navigateTo like in this tutorial and navigateTo through the Tiggr UI

  6. 6 max said at 11:02 on January 6th, 2012:

    @adam16ster: so it’s Ajax navigation both way? The result should stay on the screen in when using Ajax. Can you share the app URL with me? You can share it privately with [email protected] if you would like.

  7. 7 adam16ster said at 11:10 on January 6th, 2012:

    shared

  8. 8 max said at 11:17 on January 6th, 2012:

    @adam16ster: I ran the app, but nothing happens when I click the button. What should happen? Also, do you mind if we continue this at http://gotiggr.com/forum - it will be easier there.

  9. 9 adam16ster said at 11:26 on January 6th, 2012:

    opened the question here: http://getsatisfaction.com/gotiggr/topics/data_lost_when_leaving_then_returning_to_screen

    when ‘search near by’ is clicked, a list should be populated from cocoafish servers, then on a list item click will take you to place details that contains the back button.

    the issue could be that i haven’t stopped working on the app.

  10. 10 adam16ster said at 08:40 on January 9th, 2012:

    the tiggr api docs doesn’t show that a 2nd parameter can be passed. also what other options other than ‘s’ can be passed? more specifically what argument do i pass for the swipe transition to go from left-to-right (like going back)?

  11. 11 max said at 08:50 on January 9th, 2012:

    @adam16ster: the API will be updated. The 2nd parameter can be anything, it’s value is not important. It’s presence determines if navigation is Ajax-based.

  12. 12 Ole said at 07:33 on February 18th, 2012:

    This demo is not working on my iPhone. It should remember your selection regarding Veni,Vidi,Vici right? It goes back to default every time.

  13. 13 max said at 14:39 on February 18th, 2012:

    @Ole: how do you go back? If you are doing a full page refresh, then the value will be reset. You need to do Ajax navigation.

  14. 14 Ole said at 02:24 on February 19th, 2012:

    I was just using the demo link on this page.

  15. 15 max said at 09:25 on February 21st, 2012:

    @Ole: It works like that because the mobile screens are in separate file and there is no check yet whether a particular screen has been loaded or not and thus the screen is loaded again. We are planning to modify how this works and support exactly what you are trying to do.


Leave a Reply


  • six × = 12