简体   繁体   English

如何使用jQuery在iPhone Safari上创建照片滑块?

[英]How can I create a photo slider on iPhone Safari with jQuery?

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. 我想为iPhone版的电子商务网站创建一个产品图片查看器,并让它的行为类似于照片应用。

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. 这一切都将在移动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). 我做了一些jqTouch试验,但看起来它不支持这个想法(它有滑动支持,但没有明显的方法来链接滑动拖动图像)。

Any plugin or implementation ideas? 任何插件或实现的想法? Thanks! 谢谢!

i needed the same, solution was to use cycle and swipe plugins: 我需要相同的解决方案是使用循环和滑动插件:

"#gallery" is a container with all img tags in it. “#gallery”是一个包含所有img标签的容器。

$(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. 它有效,但不完全像Photo库,因为图像在更改之前不会拖动到宽度的50%。 just like in crmunro's solution, but based on jQuery and plugins. 就像在crmunro的解决方案中一样,但基于jQuery和插件。

不知道你是否已经解决了这个问题,但用户创建了一个iWebkit http://worldofsai.com/photos_flick.html - 也许你可以根据它来做?

you can check this example. 你可以查看这个例子。 open it in safari on your iPhone))) you can rotate, move and scale images 在iPhone上的safari中打开它)))你可以旋转,移动和缩放图像

Qtouch received a significant update in july. Qtouch在7月份收到了重大更新。 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 你可以在这个网址找到r148的下载: http//code.google.com/p/jqextensions/downloads/list

It works very well. 它工作得很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM