jQuery问题与animate和Chrome

时间:2012-11-26 20:57:35

标签: jquery google-chrome

这是jQuery的另一个主题和Chrome中的位置:D。我读了一些,但我无法找到解决方案。

function sliderCarousel(){

var count = $('#liste2').children().length; // Numbers of Elements in the Slider
var jump = $('#liste2 li:first').outerWidth(true); // Width of a single Element, including Margin(!)
var resultWidth = count * jump; // Width of all Elements in the Slider.
$('#liste2').width(resultWidth); // Sets the width of the ul to the calculated. Because the slider should work with a various number of Elements
                                 // you cant set a default width.
var unseenElementsNumber = Math.round((-1)*(resultWidth - $('#ein').width())/jump) - 1; // calculates the number of Sliderelements, which are hidden
var unseenElementsWidth = unseenElementsNumber * jump; // calculates the widht of unseen elements

    if(unseenElementsNumber >= 0)
    {
        $('#go').click(function() //rotate left
        {
            if(parseInt($('#liste2').css("left").replace("px","")) + 80 <= 0) // needed to prevent "overscrolling"
            {   
                $('#liste2').animate({
                "left": "+="+jump+"",
                }, 500 ); // speed of rotation
            }
        });

        $('#back').click(function() // rotate right
        {
            if(parseInt($('#liste2').css("left").replace("px","")) - 80 >= unseenElementsWidth) // needed to prevent "overscrolling"
            {   
                $('#liste2').animate({
                "left": "-="+jump+"",
                }, 500 ); // speed of rotation
            }
        });

        $('#start').click(function() //Return to start
        {
            $('#liste2').animate({
                "left": "0px",
                }, 500 ); // speed of rotation
        });
    }

}

所以这是我的代码。它适用于FF,但不适用于Chrome。有什么想法吗?

0 个答案:

没有答案