Problem jest dość frustrujący bo występuje tylko w jednej przeglądarce (Chrome) na IE, Operze i Firefoxie działa ok. Mianowicie slider, który przesuwa się pod ruchem myszki po zmniejszeniu widoku w przeglądarce skacze, a po zwiększeniu ucieka.
Link do strony
SliderKawałek kodu, który odpowiada za przesuwanie(całą resztę można znaleźć w źródle strony)
var sliderWidth=930;
$("#thumbScroller").css("width",sliderWidth);
var totalContent=0;
$("#thumbScroller .content").each(function () {
totalContent+=$(this).innerWidth();
$("#thumbScroller .container").css("width",totalContent+20);
});
$("#thumbScroller").mousemove(function(e){
if($("#thumbScroller .container").width()>sliderWidth){
var mouseCoords=(e.pageX - this.offsetLeft);
//alert(mouseCoords);
var mousePercentX=mouseCoords/sliderWidth;
var destX=-(((totalContent-(sliderWidth))-sliderWidth)*(mousePercentX));
var thePosA=mouseCoords-destX;
var thePosB=destX-mouseCoords;
var animSpeed=6000; //ease amount
var easeType="easeOutCirc";
if(mouseCoords==destX){
$("#thumbScroller .container").stop();
}
else if(mouseCoords>destX){
//$("#thumbScroller .container").css("left",-thePosA); //alternatywna wersja
//$("#thumbScroller .container").stop().animate({left: -thePosA}, animSpeed,easeType); //oryginal
$("#thumbScroller .container").stop().animate({left: -thePosA});
}
else if(mouseCoords<destX){
//$("#thumbScroller .container").css("left",thePosB); //alternatywna wersja
//$("#thumbScroller .container").stop().animate({left: thePosB}, animSpeed,easeType); //orginal
$("#thumbScroller .container").stop().animate({left: thePosB});
}
}
});
Przypuszczam, że jest to wina złej z czytywanej pozycji elementu ale nie wiem jak to naprawić.
Warto dodać, że uaktywni się // alternatywna wersja a weźmie w komentarz
$("#thumbScroller .container").stop().animate({left: -thePosA});
to działa poprawnie.
Ten post edytował dela 1.08.2012, 11:42:53