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

Basic touch screen support added #105

Open
wants to merge 3 commits 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
18 changes: 8 additions & 10 deletions jquery.roundabout.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
*/
(function($) {
"use strict";

var defaults, internalData, methods;

// add default shape
Expand Down Expand Up @@ -137,7 +136,8 @@
period = 360.0 / childCount,
startingChild = (settings.startingChild && settings.startingChild > (childCount - 1)) ? (childCount - 1) : settings.startingChild,
startBearing = (settings.startingChild === null) ? settings.bearing : 360 - (startingChild * period),
holderCSSPosition = (self.css("position") !== "static") ? self.css("position") : "relative";
holderCSSPosition = (self.css("position") !== "static") ? self.css("position") : "relative",
touchSupported = ('ontouchstart' in window);

self
.css({ // starting styles
Expand Down Expand Up @@ -182,7 +182,7 @@
.children(settings.childSelector)
.each(function(i) {
$(this)
.bind("click.roundabout", function() {
.bind(touchSupported? "touchstart.roundabout" : "click.roundabout", function() {
var degrees = methods.getPlacement.apply(self, [i]);

if (!methods.isInFocus.apply(self, [degrees])) {
Expand All @@ -199,7 +199,7 @@
// bind next buttons
if (settings.btnNext) {
$(settings.btnNext)
.bind("click.roundabout", function() {
.bind(touchSupported? "touchstart.roundabout" : "click.roundabout", function() {
if (!self.data("roundabout").animating) {
methods.animateToNextChild.apply(self, [self.data("roundabout").btnNextCallback]);
}
Expand All @@ -210,7 +210,7 @@
// bind previous buttons
if (settings.btnPrev) {
$(settings.btnPrev)
.bind("click.roundabout", function() {
.bind(touchSupported? "touchstart.roundabout" : "click.roundabout", function() {
methods.animateToPreviousChild.apply(self, [self.data("roundabout").btnPrevCallback]);
return false;
});
Expand All @@ -219,7 +219,7 @@
// bind toggle autoplay buttons
if (settings.btnToggleAutoplay) {
$(settings.btnToggleAutoplay)
.bind("click.roundabout", function() {
.bind(touchSupported? "touchstart.roundabout" : "click.roundabout", function() {
methods.toggleAutoplay.apply(self);
return false;
});
Expand All @@ -228,7 +228,7 @@
// bind start autoplay buttons
if (settings.btnStartAutoplay) {
$(settings.btnStartAutoplay)
.bind("click.roundabout", function() {
.bind(touchSupported? "touchstart.roundabout" : "click.roundabout", function() {
methods.startAutoplay.apply(self);
return false;
});
Expand All @@ -237,7 +237,7 @@
// bind stop autoplay buttons
if (settings.btnStopAutoplay) {
$(settings.btnStopAutoplay)
.bind("click.roundabout", function() {
.bind(touchSupported? "touchstart.roundabout" : "click.roundabout", function() {
methods.stopAutoplay.apply(self);
return false;
});
Expand Down Expand Up @@ -623,8 +623,6 @@
return this;
},



// animation
// -----------------------------------------------------------------------

Expand Down