Botão Prev & Next com contador para sobreposição usando jQuery
Eu construo esta galeria de imagens usando jquerytools, estou usando div deslocável nos polegares e sobreposição na imagem principal ... Tudo funciona como charme ..
EDIT: Antes de eu fazer isso uma recompensa ... Eu tenho que explicar que eu preciso de algo limpo e simples como este, porque as imagens vêm de php (criptografado), e eu não posso modificar isso, apenas a "visão" como eu precisa conseguir isso com algo como classes e ids. É por isso que eu tento isso, mas ...
O problema é que eu preciso inserir os botões Next e Prev quando você estiver visualizando a sobreposição ... assim você pode percorrer as imagens, uma vez que a sobreposição tenha sido carregada.
Eu fiz este violino para você meus professores cheios de sabedoria pode ver o que estou dizendo.http://jsfiddle.net/s6TGs/5/
Eu realmente tentei. mas api.next () está trabalhando para a rolagem nos polegares, então eu não sei como eu posso dizer este script .. ei se o próximo é clicado, yo pls inserir próxima url em thubs, se btn anterior é clicado, pls vá para o endereço anterior nos polegares .. Mas eu não posso
Também e não menos importante um contador como 1/8 tem que ser exibido = S ... como em nome do JavaScript você faz isso ..
Aqui está o meu código
$(function() {
$(".scrollable").scrollable();
$(".items img").click(function() {
// see if same thumb is being clicked
if ($(this).hasClass("active")) { return; }
// calclulate large image's URL based on the thumbnail URL (flickr specific)
var url = $(this).attr("src").replace("_t", "");
// get handle to element that wraps the image and make it semi-transparent
var wrap = $("#image_wrap").fadeTo("medium", 0.5);
var wrap2 = $("#mies1");
// the large image from www.flickr.com
var img = new Image();
// call this function after it's loaded
img.onload = function() {
// make wrapper fully visible
wrap.fadeTo("fast", 1);
// change the image
wrap.find("img").attr("src", url);
wrap2.find("img").attr("src", url);
};
// begin loading the image from www.flickr.com
img.src = url;
// activate item
$(".items img").removeClass("active");
$(this).addClass("active");
// when page loads simulate a "click" on the first image
}).filter(":first").click();
});
// This makes the image Overlay with a div and html
$(document).ready(function() {
$("img[rel]").overlay({
// some mask tweaks suitable for modal dialogs
mask: {
color: '#ebecff',
loadSpeed: 200,
opacity: 0.9
},
closeOnClick: true
});
});
Eu sei que aqui é parte da minha resposta eu só posso fazer o trabalho :(
http://jquerytools.org/demos/combine/portfolio/index.html
EDIT: Graças à primeira resposta por QuakeDK eu quase alcançar o objetivo .. Mas o contador não está ok, também quando você chegar à imagem 4 (número 5 no contador) você não pode ir para o polegar quinta .. Este é o CÓDIGO com essa resposta integrada
E aqui está o código para o botão PREV & NEXT
//NExt BTN
$(".nextImg").click(function(){
// Count all images
var count = $(".items img").length;
var next = $(".items").find(".active").next("img");
if(next.is(":last")){
next = $(".items").find(".active").parent().next("div").find("img:first");
if(next.index() == -1){
// We have reached the end - start over.
next = $(".items img:first");
scrollapi.begin(200);
} else {
scrollapi.next(200);
}
}
// Get the current image number
var current = (next.index("img"));
var nextUrl = next.attr("src").replace("_t", "");
// get handle to element that wraps the image and make it semi-transparent
var wrap = $("#image_wrap").fadeTo("medium", 0.5);
var wrap2 = $("#mies1");
// the large image from www.flickr.com
var img = new Image();
// call this function after it's loaded
img.onload = function() {
// make wrapper fully visible
wrap.fadeTo("fast", 1);
// change the image
wrap.find("img").attr("src", nextUrl);
wrap2.find("img").attr("src", nextUrl);
};
// begin loading the image from www.flickr.com
img.src = nextUrl;
$("#imageCounter").html("Image: "+current+" of "+count);
// activate item
$(".items img").removeClass("active");
next.addClass("active");
});
//PREV BTN
$(".prevImg").click(function(){
// Count all images
var count = $(".items img").length;
var prev = $(".items").find(".active").prev("img");
if(prev.is(":first")){
prev = $(".items").find(".active").parent().prev("div").find("img:first");
if(prev.index() == -1){
// We have reached the end - start over.
prev = $(".items img:first");
scrollapi.begin(200);
} else {
scrollapi.prev(200);
}
}
// Get the current image number
var current = (prev.index("img"));
var prevUrl = prev.attr("src").replace("_t", "");
// get handle to element that wraps the image and make it semi-transparent
var wrap = $("#image_wrap").fadeTo("medium", 0.5);
var wrap2 = $("#mies1");
// the large image from www.flickr.com
var img = new Image();
// call this function after it's loaded
img.onload = function() {
// make wrapper fully visible
wrap.fadeTo("fast", 1);
// change the image
wrap.find("img").attr("src", prevUrl);
wrap2.find("img").attr("src", prevUrl);
};
// begin loading the image from www.flickr.com
img.src = prevUrl;
$("#imageCounter").html("Image: "+current+" of "+count);
// activate item
$(".items img").removeClass("active");
prev.addClass("active");
});
Deve haver uma opção de recompensa aqui, se alguém me ajudar eu te dou 20box! jajaja estou desesperada. Porque agora eu também preciso mostrar o título para cada imagem, e eu acho que é o mesmo processo de substituição de URL, mas o próximo & prev é apenas algo que não posso gerenciar .. Poste a solução completa e seu email no paypal, eu pagarei 20!