How can I create a photo slider on iPhone Safari with jQuery?
Solution 1
i needed the same, solution was to use cycle and swipe plugins:
"#gallery" is a container with all img tags in it.
$(function() {
$('#gallery').cycle({
fx: 'scrollHorz',
timeout: 0,
next: '',
prev: '',
speed: 300,
nowrap: 0
});
});
$(function() {
$('#gallery').swipe({
swipeLeft: function() { $('#gallery').cycle("next"); },
swipeRight: function() { $('#gallery').cycle("prev") },
threshold: {
x: 15,
y: 99999
},
preventDefaultEvents: false
});
});
it works, but not exactly like Photo library, because images doesnt drag to 50% of width before changing. just like in crmunro's solution, but based on jQuery and plugins.
Solution 2
not sure if you've solved this, but an iWebkit a user has created http://worldofsai.com/photos_flick.html - maybe you could base it on that?
Ben Crouse
Updated on June 04, 2022Comments
-
Ben Crouse almost 2 years
I'd like to create an product image viewer for an iPhone version of an ecommerce site, and have it behave something like the Photos app.
Ideally, you would be able to slide images to move back and forth in the product image gallery.
This will all be done in mobile Safari.
I did a little experimenting with jqTouch, but its doesn't look like it would support this idea (it has swipe support, but there's no apparent way to link sliding to dragging an image).
Any plugin or implementation ideas? Thanks!