0

なんらかの理由で、画像カルーセルにすべての画像が一度に表示されます。理由はわかりませんが、私のcssに関係があると思います。

#full_image {
 overflow:hidden;
 position:absolute;
}

#full_image ul li img {
 width:100%;
 max-width:100%;
 list-style: none outside none;
 position: relative;
 overflow: hidden;
}

#full_image .full_close {
 background: url('icons/zoom-on.png') no-repeat;
 top: 10px;
 cursor: pointer;
 height: 29px;
 opacity: 1;
 position: absolute;
 width: 29px;
 z-index: 999;
 right: 10px;
}

#full_image .next_big {
 background: url('icons/arrow-right.png') no-repeat;
 top: 50%;
 cursor: pointer;
 height: 29px;
 opacity: 1;
 position: absolute;
 width: 29px;
 z-index: 999;
 right: 0px;
}
#full_image .prev_big {
 background: url('icons/arrow-left.png') no-repeat;
 top: 50%;
 cursor: pointer;
 height: 29px;
 opacity: 1;
 position: absolute;
 width: 29px;
 z-index: 999;
 left: 0px;
 color: #222;
}

<div id="full_image"> 
    <ul><li><img src="'+img+'" /></a></li></ul> 
    <a href="#" class="full_close"></a>
    <a href="#" class="button next_big"></a>
    <a href="#" class="button prev_big"></a>
 </div>

画像をロードする方法。

$.each(get_org_images, function (i, img) {
      if (i > 0){
          $('#full_image ul').append('<li><img src="' + img + '"/></li>');} });
4

2 に答える 2

1

JavaScript が画像を置き換えるように記述されている場合は、コードに追加する代わりにhtmlを使用する必要があります。その後、新しいイメージが古いイメージに置き換わります。

これを試して:

$.each(get_org_images, function (i, img) {
      if (i > 0){
          $('#full_image ul').html('<li><img src="' + img + '"/></li>');} });
于 2013-09-03T23:46:30.097 に答える