jquery - 显示所有图像的图像轮播

标签 jquery html css

出于某些翻转原因,我的图像轮播一次显示所有图像。我不知道为什么,但我认为这与我的 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>');} });

最佳答案

我不知道你的意思是“它们立即显示”。你希望他们做什么? 也许更多信息。会有帮助。

但是,你可以做一些性能方面的事情,比如:

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

不必每次都选择 each 中的父级。 $('#full_image').find("ul") 是比 $('#full_image ul')

更好的选择器

你可以简单地做到这一点:

parent.append('<li><img style="display:none;" src="' + img + '"/></li>');} });

哪个 .hide() 会做。

关于jquery - 显示所有图像的图像轮播,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18603107/

相关文章:

php - 在 php post jquery 后显示消息,禁用重定向

php - 我如何使用 php 从 pdf 中读取超链接?

javascript - 使用 jquery 函数选项 textarea 将 php 插入数据库时​​出错

html - div 的宽度在 IE7 中受另一个 div 的内容影响

css - 需要澄清 CSS 样式

html - 一旦我添加一些其他段落或标题,我的段落字体大小就会改变

javascript - 定时动画问题

javascript - 使用 jQuery 循环 JSON 结构

javascript - 使用不同的参数将相同的函数绑定(bind)到窗口调整大小事件

css - 像 Firebug 这样的扩展,可以实际写入文件系统