Skip to content
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
24 changes: 23 additions & 1 deletion swipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,16 @@ function Swipe(container, options) {

}

// accept touchstart by default
var enabled = true;

function disable () {
enabled = false;
}

function enable () {
enabled = true;
}

// setup initial vars
var start = {};
Expand All @@ -241,7 +251,7 @@ function Swipe(container, options) {
handleEvent: function(event) {

switch (event.type) {
case 'touchstart': this.start(event); break;
case 'touchstart': if (enabled) this.start(event); break;
case 'touchmove': this.move(event); break;
case 'touchend': offloadFn(this.end(event)); break;
case 'webkitTransitionEnd':
Expand Down Expand Up @@ -513,6 +523,18 @@ function Swipe(container, options) {
// return total number of slides
return length;
},
disable: function () {

// disable listening to touchstart
disable();

},
enable: function () {

// enable listening to touchstart
enable();

},
kill: function() {

// cancel slideshow
Expand Down