Skip to content Skip to sidebar Skip to footer

Issue In Image Thumbnail Gallery Next And Prev Buttons

Actual need for me is Initially I need to show 3thumbnail images. As I clicked on next the next three new thumbnail images should be displayed. If you refer this link http://www.f

Solution 1:

see 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();

Post a Comment for "Issue In Image Thumbnail Gallery Next And Prev Buttons"