Código CSS:
Ver original<style>
.thumb {width:80px;height:80px; cursor:pointer;}
#fullimage {width:400px;height:400px}
#pager span {cursor:pointer; background:#999; margin:3px}
</style>
Código HTML:
Ver original <img class="thumb" src="http://t0.gstatic.com/images?q=tbn:ANd9GcSAOQFybyZ06PX9rp1LLMuvpKn4wNYq2Xr64OL8ks56CE8S4ZnK5JrFqLA"> <img class="thumb" src="http://t0.gstatic.com/images?q=tbn:ANd9GcSoqw6sSp8Hidf1HM0nza4ORFIrW2CLb79Huu00ZRDMddhzupzBzA"> <img class="thumb" src="http://t3.gstatic.com/images?q=tbn:ANd9GcQPpva622B-VqRrz5UY2J_V7Ot7MJORCPgnVdfC9i2IMIj-M1SnB0Cz52G_"> <img class="thumb" src="http://t1.gstatic.com/images?q=tbn:ANd9GcREvrh6GwrCMzZubDUzmHRifhyu2uIArznljvQGJdsFywrs2xP7cn24UNY_"> <img class="thumb" src="http://t3.gstatic.com/images?q=tbn:ANd9GcS5hQO29sQXRXj-GyU7d_sGb1P9koIu8FGcaEBCQE9h4PoJ22zcwqKn9eA">
<img src="http://t0.gstatic.com/images?q=tbn:ANd9GcSAOQFybyZ06PX9rp1LLMuvpKn4wNYq2Xr64OL8ks56CE8S4ZnK5JrFqLA" id="fullimage" />
Código Javascript
:
Ver originalvar limite = 4, pagejump = 4, page = 0;
$(document).ready(function(){
var thumb = $(".thumb");
$('.thumb:gt('+(limite-1)+')').hide();
thumb.click(function(){ //cambiar imagen grande por el src del thumb seleccionado
var imagen = $(this).attr('src')
$('#fullimage').fadeOut('fast',function(){ //ocultar img anterior
$(this).attr('src',imagen).fadeIn('fast') //mostrar nueva img
})
})
$("#pager span").click(function(){ //next prev first last
var e = $(this);
if(e.hasClass('next')){page++}else if(e.hasClass('prev')){page--}
if(page<0||e.hasClass('first')){page=0}
if(page==Math.ceil(thumb.length/pagejump)|| e.hasClass('last')) {page = Math.ceil(thumb.length/pagejump) - 1}
thumb.each(function(index){
if(index >= page*pagejump && index < limite+(page*pagejump)){$(this).show()}else{$(this).hide()} //mostrar pagina
})
})
})