简体   繁体   English

jQuery图像库中的上一个和下一个按钮

[英]jquery previous and next button in image gallery

I am making a simple image gallery 我正在制作一个简单的图片库

http://jsfiddle.net/QEh53/1/ http://jsfiddle.net/QEh53/1/

Imgs array can store upto 36 images and i wants to display only first 6 onload. Imgs阵列最多可以存储36张图像,我只想显示前6个onload。 there is one next and back button, I need it when click on Next it will show next 6 images from Imgs array and on clicking Back last 6 images should slide in. if there is no img left in prev or next it should loop through next 6 images. 有一个“下一步”和“后退”按钮,单击“下一步”将显示Imgs数组中的下6张图像,然后单击“返回”,最后6张图像应滑入其中。 6张图片。

Thank you for any help. 感谢您的任何帮助。

Edit: 编辑:

I have tried this with just back button but for some reason it is not removing old list before adding new one http://jsfiddle.net/QEh53/6/ 我已经尝试过后退按钮,但是由于某种原因,它并没有在添加新的列表之前删除旧列表http://jsfiddle.net/QEh53/6/

Edit: 编辑:

here was solution: jQuery gallery turn over with next and previous buttons 这是解决方案: jQuery库通过下一个和上一个按钮进行切换

I belive this code will help you: example.js 我相信这段代码将为您提供帮助: example.js

total is the amount of "pages", you can set it as Math.ceil( totalImages / 6 ) . total是“页面”的数量,您可以将其设置为Math.ceil( totalImages / 6 )

This, nonstopping pages was called loop in that code. 这个不停的页面在该代码中称为loop It returns a correct page, as you wanted. 它会根据需要返回正确的页面。

function loop( value )
{
    return value < 0 ? total + value : ( value >= total ? value % total : value );
}

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

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