我有一个图像列表,我想要使用next/previous按钮循环浏览。但我在做这件事情时遇到了麻烦。到目前为止,我已经设法继续恢复到第一张图片,无论我点击下一个链接时的图像。使用jQuery移动到unorder列表中的下一个元素
对列表中的HTML是..
<div class="wrapper">
<div class="slider-container">
<ul class="wineslider">
<li>
<img src="assets/img/shop/redwine/bottle.png" alt="1">
<div class="info">
<p>I am wine information 1 </p>
</div>
</li>
<li>
<img src="assets/img/shop/redwine/bottle.png" alt="2">
<div class="info">
<p>I am wine information 2</p>
</div>
</li>
<li>
<img src="assets/img/shop/redwine/bottle.png" alt="3">
<div class="info">
<p>I am wine information 3</p>
</div>
</li>
.....
<a href="#" class="previous">Previous</a>
<a href="#" class="next">Next</a>
</div>
</div>
jQuery的我一直在摆弄周围是
这个幻灯片图像,如果他们点击 - 该位似乎工作没关系。
$(document).ready(function() {
$('.wineslider li').bind({
click: function() {
$('.wineslider li').stop().animate({'width':'60px'},600);
$(this).stop().animate({'width':'420px'},600); // Width of slideout box
$('.info').css('display','block');
},
});
// Find number of slides
var count = $('li').length;
//alert(count);
// Set current slide number
var curr = 1;
ert(curr);
});
下一按钮
var active = 0; // starts at zero
var list = $('ul.wineslider');
$("a.next").click(function(event){
event.preventDefault(); // cancel click through
var currentElement = $('.wineslider li');
var i = $(currentElement).index();
currentElement = currentElement.next();
scrollTo(currentElement);
$('.wineslider li').stop().animate({'width':'60px'},600);
$(currentElement).stop().animate({'width':'420px'},600); // Width of slideout box
$('.info').css('display','block');
});
由于事先:d