do-web / jTinder

jTinder is a javascript library that makes rating people, products, images very easy and fast. It is optimized for mobile touch device but has also a desktop fallback.
GNU General Public License v2.0
235 stars 101 forks source link

How to Undo Swipe? #27

Open PriyankaRose opened 7 years ago

PriyankaRose commented 7 years ago

Hello,

I need a way to undo the swipe (left/right). Is there a way for it?

yanmendes commented 7 years ago

Add this function on the JTinder js file:

undo: function () { if(current_pane !== panes.length - 1) { ++current_pane; panes.eq(current_pane).animate({"transform": "translate(0px,0px) rotate(0deg)"}, $that.settings.animationRevertSpeed); panes.eq(current_pane).find($that.settings.likeSelector).css('opacity', 0); panes.eq(current_pane).find($that.settings.dislikeSelector).css('opacity', 0); panes.eq(current_pane).show(); } },

To call it from your file simply do $('#tinderslide').jTinder('undo');

nikhilthegrizzlybear commented 6 years ago

Does this still work yanmendes by any chance?

yanmendes commented 6 years ago

Yes, it does

Israel2709 commented 6 years ago

Hi! how can I implement this undo function on an onclick event of a button?

yanmendes commented 6 years ago

$(document).on("click", "#undo", function (e){ $('#tinderslide').jTinder('undo'); });