使用 jQTouch javascript iphone / ipad 的简单滑动图库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3552518/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 01:30:02  来源:igfitidea点击:

Simple swipe gallery with jQTouch javascript iphone / ipad

javascriptiphoneipadjqtouchextjs

提问by Roflcart

What I wish to achieve is have a simple gallery of images which the user can swipe through using jQTouch ( http://jqtouch.com)

我希望实现的是有一个简单的图像库,用户可以使用 jQTouch ( http://jqtouch.com)滑动

<div id="container">
<img src="1.gif">
<img src="2.gif">
<img src="3.gif">
</div>

The images are quite long, for example 200px in width each. The container itself is 300px wide with hidden overflow.

图像很长,例如每个图像的宽度为 200 像素。容器本身是 300px 宽,带有隐藏的溢出。

What I wish to happen is when the user swipes the galley container, it drags the images to the left/right.

我希望发生的是当用户滑动厨房容器时,它将图像拖到左/右。

So far I have set up the container to receive swipe events and which direction it is in, however to be honest I have completely no idea where to go on from there.

到目前为止,我已经设置了容器来接收滑动事件以及它在哪个方向,但是老实说我完全不知道从那里开始。

Any advice appreciated.

任何建议表示赞赏。

回答by William Niu

Have you come across this demo?

你遇到过这个演示吗?

"Photo Gallery" and "Photo Gallery 2" may be what you want. And if you just want to have photos and some captions, it should be fairly simple to setup:

“照片库”和“照片库 2”可能就是您想要的。如果您只想拥有照片和一些标题,那么设置应该相当简单:

jQT.generateGallery("pageID",
    [
    {src:"http://www.site.com/somepic.jpg"},
    {src:"pic1.jpg",caption:"Test Image 1"}
    ],
    {defaultIndex:1}
);

You'll need the the jQT photo extension: jqt.photo.jsand jqt.photo.css.

您将需要 jQT 照片扩展名:jqt.photo.jsjqt.photo.css.

回答by Brad Birdsall

Check out this lightweight mobile slider I just released. Swipemight be able to solve your problem :)

看看我刚刚发布的这个轻量级移动滑块。刷卡也许可以解决您的问题:)