user974896
user974896

Reputation: 1813

jQuery Mobile swipe to "nothing"

I found another SO question that had a fiddle with similar functionality to what I'm trying to do. Instead of swiping to a new div however I would like to simply slide the div off the screen

http://jsfiddle.net/yxzZf/4/

$("#listitem").swiperight(function() {
    $.mobile.changePage("#page1");
});

The div in question is actually a jQuery UI dialog, $("#div").dialog({...});. I would like to simply swipe it off the screen and close it.

Upvotes: 0

Views: 367

Answers (3)

Vicky Gonsalves
Vicky Gonsalves

Reputation: 11717

Use this:

$("#listitem").swiperight(function() {
$.mobile.changePage("#page2");

});

​And point page to to a blank page

Check this fiddle

Upvotes: 0

Gajotres
Gajotres

Reputation: 57309

Something like this:

$('#home').live('pagebeforeshow',function(e,data){    
    $("#listitem").bind('swiperight',function(event, ui){
        $.mobile.changePage("#page1", { transition: "slide", reverse: true});
    });
});

Example: http://jsfiddle.net/Gajotres/UaupV/

Upvotes: 1

stefanz
stefanz

Reputation: 1326

Assuming that you're talking about a popup you can do stuff like this :

$("#listitem").swiperight(function() {
    var t = $(this);
    t.animate({
        right: '-999px'
    }, 'slow', function() {
        t.remove();
    })
});​

Upvotes: 0

Related Questions