Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquery carousel-can';我看不到以前的图像在滑动_Jquery_Carousel - Fatal编程技术网

jquery carousel-can';我看不到以前的图像在滑动

jquery carousel-can';我看不到以前的图像在滑动,jquery,carousel,Jquery,Carousel,请访问JSFIDLE: 单击“下一步”按钮效果很好(当前图像向左滑动,下一个图像向内滑动),但是当我单击“上一步”按钮时,它确实起作用,但在集合中的上一个图像中它没有滑动 我不确定我做错了什么,有人能帮我吗 代码如下: $.carousel = function(obj){ var width = $(obj).find('ul').find("li:first").outerWidth(); $(obj).find('.slider_prev').click(function() {

请访问JSFIDLE:

单击“下一步”按钮效果很好(当前图像向左滑动,下一个图像向内滑动),但是当我单击“上一步”按钮时,它确实起作用,但在集合中的上一个图像中它没有滑动

我不确定我做错了什么,有人能帮我吗

代码如下:

$.carousel = function(obj){
var width = $(obj).find('ul').find("li:first").outerWidth();

$(obj).find('.slider_prev').click(function() {
   if($(obj).find('li').length > 1) {
       $(obj).find('ul').animate({marginLeft:326},750,function(){
            $(this).find("li:last").after($(this).find("li:first"));
            $(this).css({marginLeft:0});
       })
   }               
   return false;
});
$(obj).find('.slider_next').click(function() {
   if($(obj).find('li').length > 1) {
        $(obj).find('ul').animate({marginLeft:-326},750,function(){
            $(this).find("li:last").after($(this).find("li:first"));
            $(this).css({marginLeft:0});
        })
   }
   return false;
}); 
}
$.carousel('#slider_1');​

在任何给定的时间,都应该在您实际查看的图像的左侧和右侧有一个图像。我会更新逻辑以包含第三个
li

,不幸的是,这并没有解决问题。不过,我确实找到了另一个简单图库的修复方法: