Skip to content

Added iOS horizontal swipe gesture support #100

Open
wants to merge 5 commits into from

5 participants

@matehat
matehat commented Jan 10, 2012

I added an option swipe: {true|false} that, when set to true, allows the user of a iOS device to swipe through slides using one finger.

matehat added some commits Jan 10, 2012
@matehat matehat Enable horizontal swiping gesture on compatible iOS devices. 6b15c61
@matehat matehat Removed unnecessary comments 9a4f2ea
@matehat matehat Detect `deltaX < deltaY`
Added a detection for the direction of greatest amplitude (X or Y) to
allow Y scrolling and X swiping
8c076d7
@matehat matehat Detect rollback swipe gesture
Detect the case when swipe begins in one direction, but reverses before
ending, indicating a desire to return to the original slide.
14cc0a3
@gvandenb

You may want to add a line to account for when there is only one slide. We use the slider on a site to show an artists other videos and they sometimes have less videos than what the visible option is set to.

I just added the following on ln 344 ish and it works great now in all cases,
if (this.$slides.length == "1") { return false; }

thanks for adding the swipe functionality, it really enhances the mobile experience for us.

Applied (0b7380f)! Thanks a lot for pointing this case out!

@matehat matehat Made sure the sliding gesture is not activated when the number of sli…
…des is not sufficient

Thanks to @gvandenb for pointing out this case
0b7380f
@knewter
knewter commented Jan 28, 2012

+1 on this, I'm definitely applying the patch for my own project :)

@benmort
benmort commented May 25, 2012

great work ill be using this for my next slider! cheers

@farser
farser commented Jun 27, 2012

Call me daft but I can't for the life of me work out how to enable swipe.

I also can't seem to find working examples of this in action anywhere. The version available here at git and at foundation.zurb.com don't swipe on my iphone 4s

hoping someone can point me in the right direction. thanks

@matehat
matehat commented Jun 27, 2012

Hey,

You won't find it there because Zurb hasn't merged in this pull request, but you can find a working demo at : http://www.matehat.com/orbit/demo/demo.html

If you want to enable it for your project, you'd need to use my branch.

The first orbit is swipe-enabled and second isn't.

I also implemented this on http://storm.io, although not as a Zurb Orbit widget.

Good luck!

@farser
farser commented Jun 28, 2012

Excellent! Thanks for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.