Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/461.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
Javascript 在chrome中设置jquery动画时ul li的位置_Javascript_Jquery_Html_Css_Google Chrome - Fatal编程技术网

Javascript 在chrome中设置jquery动画时ul li的位置

Javascript 在chrome中设置jquery动画时ul li的位置,javascript,jquery,html,css,google-chrome,Javascript,Jquery,Html,Css,Google Chrome,我有一个div具有相对位置和ul具有绝对位置 我想当点击右键时,一个li附加到ul上,ul根据li的大小向右移动;它在FF中工作,但在chrome和IE中,所有的li都坚持在页面的右侧,并且不显示任何li 我的问题在哪里?(我写了一个滑块,当点击右键时,这个主题) $(\u rightNavigator)。单击(函数(){ var_number=$(“#thumbviewer”).children(“li:last”).index()+1; 如果(_numberuse jsfiddle plz+

我有一个
div
具有
相对位置和
ul
具有
绝对位置

我想当点击右键时,一个
li
附加到
ul
上,ul根据li的大小向右移动;它在FF中工作,但在chrome和IE中,所有的li都坚持在页面的右侧,并且不显示任何
li

我的问题在哪里?(我写了一个滑块,当点击右键时,这个主题)

$(\u rightNavigator)。单击(函数(){
var_number=$(“#thumbviewer”).children(“li:last”).index()+1;

如果(_numberuse jsfiddle plz+html source)你也可以添加基本的html吗?@Danko我添加了html编码,你可以查看chrome控制台,看看是否有任何输出可以提供建议或帮助,你可以与我们分享一个例子吗……我认为这种方式是可行的
$(_rightNavigator).click(function () {
  var _number = $("#thumbviewer").children("li:last").index() + 1;
  if (_number <= settings.imgAddress.length) {
    $("#thumbviewer").append("<li><a href='#'><img class='loading thumb' src=" + settings.imgAddress[_number] + " width='120' height='120' /></a></li>");
    $("#thumbviewer li").css("margin-left", Math.floor(($(settings.photoViewerId).width() - ($("#thumbviewer li").width() * _removeCount)) / _removeCount)); //it's return margin size for any li
    $("#thumbviewer").animate({
      left: '+=' + $("#thumbviewer li").outerWidth(true) + 'px'
    }, 1000);
  }
});
img { 
  border:none; 
}
#thubmviewer-holder { 
  position:relative !important;
  height: 132px; 
  border: 3px solid #808080; 
  overflow: hidden
}
.photoviewer{ 
  text-align:center;
  min-height:300px; 
}
.thumbviewer { 
  position:absolute;
  padding:0 5px 0 0;
  margin:0;
  text-align:center;
  border:1px solid red; 
}
.thumbviewer li { 
  list-style:none;
  border:1px solid blue;
  float:right
}
.thumbviewer li a { 
  text-decoration:none;
  float:right;
  padding:4px 2px;
  margin:0;
}
.thumbviewer li a img{
  border:2px solid #808080;
  border-radius:5px;
}
.loading{
  background:url('images/loading.gif') no-repeat center center;
  min-height:300px;
}
.thumb{
  width:120px;
  min-height:120px !important;
}
.left-nvg{      
  display:none;
  background:url('images/arrows.png') no-repeat -7px  -7px;
  width:36px;
  height:36px;
  cursor:pointer
}
.right-nvg{
  display:none;
  background:url('images/arrows.png') no-repeat -57px -7px;
  width:36px;
  height:36px;
  cursor:pointer
}
.right-nvg:hover{
  background-position: -57px -57px;
}
.left-nvg:hover{
  background-position: -7px -57px;
}


<div id="thumbviewer">
        <ul id="thumbviewer" class="thumbviewer" style="width: 2160px; left: 145px;">
            <li style="margin-left: 15px;"><a href="#">
                <img class="loading thumb" src="../Uploades/Img/Tulips.jpg" width="120" height="120"></a></li>
            <li style="margin-left: 15px;"><a href="#">
                <img class="loading thumb" src="../Uploades/Img/Koala.jpg" width="120" height="120"></a></li>
</ul>