
ALBOR (Tipo Spring Blanco)
18,00 €
-33%
12,00 €
❮
');
var $nextArrow = $('❯
');
if (imagenesGaleria.length <= 1) {
$prevArrow.hide();
$nextArrow.hide();
}
$fullscreenContent.append($fullscreenClose);
$fullscreenContent.append($prevArrow);
$fullscreenContent.append($fullscreenImg);
$fullscreenContent.append($nextArrow);
$fullscreenModal.append($fullscreenContent);
$('body').append($fullscreenModal);
setTimeout(function() {
$fullscreenModal.addClass('active');
}, 10);
function cambiarImagen(direccion) {
if (direccion === 'next') {
currentImageIndex = (currentImageIndex + 1) % imagenesGaleria.length;
} else {
currentImageIndex = (currentImageIndex - 1 + imagenesGaleria.length) % imagenesGaleria.length;
}
var nuevaImagen = imagenesGaleria[currentImageIndex];
$fullscreenImg.fadeOut(200, function() {
$(this).attr('src', nuevaImagen);
$(this).fadeIn(200);
});
$('.custom-thumbnail').removeClass('active');
$('.custom-thumbnail').eq(currentImageIndex).addClass('active');
}
$prevArrow.on('click', function(e) {
e.stopPropagation();
cambiarImagen('prev');
});
$nextArrow.on('click', function(e) {
e.stopPropagation();
cambiarImagen('next');
});
$fullscreenClose.on('click', function() {
cerrarPantallaCompleta($fullscreenModal);
});
$fullscreenModal.on('click', function(e) {
if ($(e.target).hasClass('custom-fullscreen-modal')) {
cerrarPantallaCompleta($fullscreenModal);
}
});
$(document).on('keydown.fullscreen', function(e) {
if (e.key === 'Escape') {
cerrarPantallaCompleta($fullscreenModal);
} else if (e.key === 'ArrowRight') {
cambiarImagen('next');
} else if (e.key === 'ArrowLeft') {
cambiarImagen('prev');
}
});
});
function cerrarPantallaCompleta($modal) {
$modal.removeClass('active');
setTimeout(function() {
$modal.remove();
}, 300);
$(document).off('keydown.fullscreen');
}
});