Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery与animate和Chrome的问题_Jquery_Google Chrome - Fatal编程技术网

jQuery与animate和Chrome的问题

jQuery与animate和Chrome的问题,jquery,google-chrome,Jquery,Google Chrome,下面是Chrome中jQuery和positions的另一个线程: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, includi

下面是Chrome中jQuery和positions的另一个线程: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
        });
    }
函数sliderCarousel(){
var count=$('#list2').children().length;//滑块中的元素数
var jump=$('#list2 li:first')。outerWidth(true);//单个元素的宽度,包括边距(!)
var resultWidth=count*jump;//滑块中所有元素的宽度。
$(“#list2”).width(resultWidth);//将ul的宽度设置为计算的宽度。因为滑块应使用不同数量的元素
//不能设置默认宽度。
var unseenElementsNumber=Math.round(-1)*(resultWidth-$('#ein').width())/jump)-1;//计算隐藏的滑块元素数
var unseenElementsWidth=unseenElementsNumber*jump;//计算不可见元素的宽度
如果(未启用元素数目>=0)
{
$('#go')。单击(函数()//向左旋转
{
if(parseInt($('#list2').css(“left”).replace(“px”)和“)+80=uneseelementswidth)//需要防止“过度滚动”
{   
$('#list2')。设置动画({
“左”:“-=”+跳转+”,
},500);//旋转速度
}
});
$(“#开始”)。单击(函数()//返回开始
{
$('#list2')。设置动画({
“左”:“0px”,
},500);//旋转速度
});
}
}


这是我的代码。它与FF配合使用效果很好,但不适用于Chrome。有什么想法吗?

控制台上怎么说?
“px”
后面有一个多余的逗号。控制台中有错误消息吗?请注意,您不需要执行
。replace()
删除“px”,因为
parseInt()
已经忽略了输入字符串末尾的任何非数字。我现在发布了整个代码。这适用于FF。我回家后会给你一杯冰激凌。感谢您:)Hrm,控制台上没有错误。