views:

2629

answers:

5

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!

A: 

you can check this example. open it in safari on your iPhone))) you can rotate, move and scale images

Morion
Thanks, but I'd really like to use jQuery, and I don't need anywhere near that kind of flexbility. I'd just like the images to slide left or right.
Ben
+1  A: 

Hi there, 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?

crmunro
thanks for the link thats awsome
jasondavis
Original code for that gallery and the tutorial available: http://mydailyphoto.com/blog/iphone-safari-flick-navigation
Jared Updike
A: 

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.

jnk
+1  A: 

Or reference this page:

http://james.limsbros.com/2010/09/27/javascript-swipe-demo-works-both-with-finger-ipad-and-mouse-pc/

The demo on the wordpress page (not the fullscreen demo) uses the following technique: You have multiple DIVs in a display DIV, which causes the display DIV to be scrollable, but also use overflow:hidden to hide the scrollbar.

Then use javascript to set the scrollLeft to scroll thru the inner DIVs.

James Lin
A: 

Qtouch received a significant update in july. The full source package now include demos for video embedding and swipeable image galleries.

You can find the download of r148 at this url: http://code.google.com/p/jqextensions/downloads/list

It works very well.

Hope this help.

Sergio

sfarinel