Browse Source

Remove touchstart events

pull/21/head
Viljami S 13 years ago
parent
commit
835dcbcce2
  1. 20
      responsiveslides.js

20
responsiveslides.js

@ -24,10 +24,6 @@
length = $slide.size(), length = $slide.size(),
fadetime = parseFloat(settings.fade), fadetime = parseFloat(settings.fade),
// Touch support
hasTouch = 'ontouchstart' in window,
startEvent = hasTouch ? 'touchstart' : 'mousedown',
// Namespacing // Namespacing
namespace = "rslides", namespace = "rslides",
namespaceIndex = namespace + i, namespaceIndex = namespace + i,
@ -151,7 +147,8 @@
if (settings.pagination === true) { if (settings.pagination === true) {
// On touch start // On touch start
$tabs.bind(startEvent, function () { $tabs.bind("click", function (e) {
e.preventDefault();
restartCycle(); restartCycle();
// Get index of clicked tab // Get index of clicked tab
@ -179,9 +176,6 @@
.closest("li") .closest("li")
.addClass(activeClass); .addClass(activeClass);
// On click
$tabs.bind("click", function (e) { e.preventDefault(); });
} }
} }
@ -202,7 +196,8 @@
$next = $("." + namespaceIndex + "_nav_next"); $next = $("." + namespaceIndex + "_nav_next");
// Previous slide // Previous slide
$prev.bind(startEvent, function (e) { $prev.bind("click", function (e) {
e.preventDefault();
var idx = $slide.index($("." + visibleClass)), var idx = $slide.index($("." + visibleClass)),
idxTo = idx - 1; idxTo = idx - 1;
if ($("." + visibleClass + ":animated").length) { if ($("." + visibleClass + ":animated").length) {
@ -214,7 +209,8 @@
}); });
// Next slide // Next slide
$next.bind(startEvent, function (e) { $next.bind("click", function (e) {
e.preventDefault();
var idx = $slide.index($("." + visibleClass)), var idx = $slide.index($("." + visibleClass)),
idxTo = idx + 1 < length ? index + 1 : 0; idxTo = idx + 1 < length ? index + 1 : 0;
if ($("." + visibleClass + ":animated").length) { if ($("." + visibleClass + ":animated").length) {
@ -224,10 +220,6 @@
slideTo(idxTo); slideTo(idxTo);
selectTab(idxTo); selectTab(idxTo);
}); });
// On click
$prev.bind("click", function (e) { e.preventDefault(); });
$next.bind("click", function (e) { e.preventDefault(); });
} }
// Add fallback if max-width isn't supported and settings "maxwidth" is set // Add fallback if max-width isn't supported and settings "maxwidth" is set

Loading…
Cancel
Save