jQuery幻灯片插件:当只有一张幻灯片时,幻灯片图像不可见

时间:2011-07-27 22:33:43

标签: jquery slider image-gallery

我正在使用Nathan Searles very nice Slides plugin

我有一个页面,其中包含幻灯片显示的多个动态实例:http://hnoc.dreamhosters.com/dev/property_info.php?lot=22644

当滑块中只有一个图像时,不显示图像。上面链接的第一个滑块显示此问题。当存在多个图像时,它们都显示正常:http://hnoc.dreamhosters.com/dev/property_info.php?lot=22622

以下是第一个链接上单个图像的代码。

这会响铃吗?我有错误吗?

最值得赞赏的任何建议!

<div id="container1">
<div id="slides1">
<div class="slides_container">
<div class="slides_control">
<div class="slide" style="">
<a href="images/intermediate/I014N1013.jpg" rel="lightbox" title="Title: Plan of eight lots of ground with the buildings and improvements thereon...">
<img class="content" src="images/covers/C014N1013.jpg" alt="C014N1013.jpg"></a>
<div class="caption" style="bottom: 0px; ">Plan of eight lots of ground with the buildings and improvements thereon... </div>
</div> <!-- slide -->
</div> <!-- slides_control -->
</div> <!-- slides_container -->
<a href="#" class="prev"><img src="js/slides/img/arrow-prev.png" width="24" height="43" alt="Arrow Prev"></a>
<a href="#" class="next"><img src="js/slides/img/arrow-next.png" width="24" height="43" alt="Arrow Next"></a>   
</div> <!-- slides1 -->
<img src="js/slides/img/example-frame.png" width="739" height="341" alt="Frame" id="frame1">
</div>

2 个答案:

答案 0 :(得分:1)

编辑slides.jquery.js

// after the variable setting on and after line 29
var elem = $(this),
control = $('.slides_control',elem),
total = control.children().size(),
... snip ...
playInterval;

添加

if (total == 1){        
  $('.'+option.container,elem).css({display:'block'});          
  // disable prev/next imgs
  $('.'+option.prev+' img',elem).css({display:'none'});
  $('.'+option.next+' img',elem).css({display:'none'});
}

解决了这个问题。

和平。

答案 1 :(得分:0)

在滑动时间内缺少此Slides.js长度检查代码。请尽可能多地查看代码。

在下面的js文件中添加 if(this.data.total!= 1)

if(!this.data.animating&amp;&amp; number!== this.data.current + 1){

            **if (this.data.total != 1) {**

                if (next === -1) {
                    next = this.data.total - 1;
                }
                if (next === this.data.total) {
                    next = 0;
                }
              .............

            }
        **}**
    };