Ciao
Ho caricato una galleria realizzata con jquery.
Le immagini però non vengono mostrate correttamente. Sembrano che sia ingrandite zoomate insomma.
Ho provate a scaricarle (tasto destro->salva immagine) e le dimensioni sono quelle giuste. Il problema è solo nella visualizzazione. Ho provato a trovare il problema ma ci capisco poco di jquery, comunque se non sbaglio il problema dovrebbe essere in queste righe di codice:
Codice:
/* Handle Slider */
var slider = $("#slider");
var isSliding = false;
var sliderHolder = slider.children('ul');
var sliderSlides = sliderHolder.children('li');
var sliderImages = sliderSlides.children('img');
slider.height($(window).height());
sliderSlides.eq(0).addClass('active');
$(window).load(function(){
AlignSliderImages(slider, sliderImages);
SliderInit();
}).resize(function(){
slider.height($(window).height());
AlignSliderImages(slider, sliderImages);
}).mousemove(function(e){
if (imagesAreAligned)
{
var r = (e.clientY * 100 / $(window).height());
sliderHolder.css({
'top': (25 * (100-r) / 100),
'bottom': (25 * r / 100)
});
}
});
slider.children('.slider-prev').click(function(e){
e.preventDefault();
if (!isSliding)
{
clearInterval(window.sliderIntervalId);
var currentSlide = sliderHolder.children('.active');
var currentSlideIndex = currentSlide.index();
var nextSlide = sliderSlides.eq(--currentSlideIndex < 0 ? (sliderSlides.length-1) : currentSlideIndex);
Slide(currentSlide, nextSlide);
SliderInit();
}
});
slider.children('.slider-next').click(function(e){
e.preventDefault();
if (!isSliding)
{
clearInterval(window.sliderIntervalId);
var currentSlide = sliderHolder.children('.active');
var currentSlideIndex = currentSlide.index();
var nextSlide = sliderSlides.eq(++currentSlideIndex >= sliderSlides.length ? 0 : currentSlideIndex);
Slide(currentSlide, nextSlide);
SliderInit();
}
});
slider.children(".slider-back").click(function(e){
e.preventDefault();
history.go(-1);
});
var queuedImagesToBeLoaded = 0;
slider.find("img").each(function(){
if (queuedImagesToBeLoaded++ < totalImagesToBeLoaded)
{
Preloader.Instance.AddImageInQueue($(this).attr('src'));
}
});
Preloader.Instance.LoadImages();
function AlignSliderImages(slider, images)
{
var sliderWidth = slider.width();
var sliderHeight = slider.height()+80;
var sliderRate = sliderWidth / sliderHeight;
var currentImage = images.eq(0);
var rate = currentImage.width() / currentImage.height();
if (rate > sliderRate)
{
var width = sliderHeight * rate;
images.css({
'width': width,
'height': sliderHeight,
'margin-top': -40,
'margin-left': (sliderWidth - width) / 2
});
}
else
{
var height = sliderWidth / rate
images.css({
'width': sliderWidth,
'height': height,
'margin-top': (sliderHeight - height - 20) / 2,
'margin-left': 0
});
}
imagesAreAligned = true;
slider.children('ul').removeClass('before-init');
}
function SliderInit()
{
window.sliderIntervalId = setInterval(function(){
var currentSlide = sliderHolder.children('.active');
var currentSlideIndex = currentSlide.index();
var nextSlide = sliderSlides.eq(++currentSlideIndex >= sliderSlides.length ? 0 : currentSlideIndex);
Slide(currentSlide, nextSlide);
}, 9000);
}
function Slide(currentSlide, nextSlide)
{
isSliding = true;
currentSlide.animate({ 'opacity': 0 }, 800, function(){
currentSlide.removeClass('active');
});
nextSlide.animate({ 'opacity': 1 }, 800, function(){
nextSlide.addClass('active');
isSliding = false;
});
}
/* End Handle Slider */
/* Handle Side Posts */
$("#blog-listing").each(function(){
var side = $(this).find(".site-side");
side.each(function(){
var main = side.siblings(".site-main");
var articles = side.children(".post");
while (side.height() > main.height() && articles.length > 0)
{
articles.eq(articles.length-1).remove();
articles = side.children(".post");
}
});
});
/* End Handle Side Posts */
Potete aiutarmi a capire cosa c'è che non va?
Grazie