Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to recalculate after new elements have been added to dom #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions js/jquery.jTinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
dislikeSelector: '.dislike'
};

var tinderslide = null;
var container = null;
var panes = null;
var $that = null;
Expand All @@ -38,19 +39,26 @@
Plugin.prototype = {


init: function (element) {

container = $(">ul", element);
panes = $(">ul>li", element);
pane_width = container.width();
pane_count = panes.length;
current_pane = panes.length - 1;
$that = this;
init: function (element) {
$that = this;
tinderslide = element;

$(element).bind('touchstart mousedown', this.handler);
$(element).bind('touchmove mousemove', this.handler);
$(element).bind('touchend mouseup', this.handler);
},
$that.startOver();

$(element).bind('touchstart mousedown', this.handler);
$(element).bind('touchmove mousemove', this.handler);
$(element).bind('touchend mouseup', this.handler);
},

startOver: function () {
container = $(">ul", tinderslide);
panes = $(">ul>li", tinderslide);
pane_width = container.width();
pane_count = panes.length;
current_pane = panes.length - 1;

},

showPane: function (index) {
panes.eq(current_pane).hide();
Expand Down