繁体   English   中英

图像缩略图库的下一个和上一个按钮中的问题

[英]Issue in Image Thumbnail Gallery next and prev buttons

对我的实际需求是,最初我需要显示3thumbnail图片。 当我单击下一步时,应该显示接下来的三个新缩略图。 如果您引用此链接,则http://www.frontendwebhelp.com/javascript/jquery-photo-gallery.php

这正是我所需要的。 在此,下一个和上一个按钮的功能对于缩略图图像和较大图像而言是不同的。

我不应该使用任何类型的轮播插件来获得这种效果。

这是我尝试过的。

http://jsfiddle.net/L7yKp/37/

我需要协助。

参见http://jsfiddle.net/L7yKp/60/

function thumbs(i,incr){
    var num_thumbs=2;
    if(i===null){
        i=$("#thumbs").prop('data-index'),
        i+=num_thumbs*incr;
    }
    i=Math.max(1,Math.min(i,$('#thumbs .UiUx3DSSVFlow').length-num_thumbs+1));
    $("#thumbs").prop('data-index',i);
    $('#thumbs .UiUx3DSSVFlow').hide();
    $('#thumbs .UiUx3DSSVFlow:nth-child(n+'+i+'):nth-child(-n+'+Number(i+num_thumbs-1)+')').show();
}
$("#panel .UiUx3DSSVFlow").not(':first').hide();
$("#thumbs .UiUx3DSSVFlow").click(function(){
    getIndex = $(this).index();
    $("#thumbs .clicked").removeClass('clicked');
    $("#panel .UiUx3DSSVFlow").hide().eq(getIndex).show();  
    $(this).addClass('clicked');
    thumbs(getIndex+1);        
});
$("#thumbs .UiUx3DSSVFlow:first").click();
$("#thumbs").prop('data-index',1);
$([['next',1],['prev',-1]]).each(function(){
    var that=this;
    $('#t'+that[0]).click(function(){
        thumbs(null,that[1]);
    });
    $('#l'+that[0]).click(function(){
        $('#thumbs .clicked')[that[0]]().click();
    });
});
$('#tprev').click();

暂无
暂无

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

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