闪光的unstyle内容

时间:2018-03-20 20:03:51

标签: javascript jquery html css jquery-cycle2

我对cycle2有以下问题,当页面加载时我的所有图片都会短暂显示,可能有解http://jquery.malsup.com/cycle/faq.html 但它对停止闪烁没有帮助,所以问题似乎有所不同:

对于Cycle,可能的解决方案是:使用CSS隐藏除第一张幻灯片图像之外的所有图像。例如:

#slideshow img { display: none }
#slideshow img.first { display: block }

...

 <div id="slideshow">
    <img src="image1.jpg" width="200" height="200" class="first" />
    <img src="image2.jpg" width="200" height="200" />
    <img src="image3.jpg" width="200" height="200" />
 </div>

我最初的问题是,如何将这两条css两行应用于cycle2代码,但在测试推荐后,它没有帮助,因此寻找解决方案如何防止闪烁。

以下是我的inc / top.inc.php文件中的cycle2代码的样子:

 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
 <script src="http://example.com/js/jquery.cycle2.min.js"></script>

 <div class="fl_left logo_add">
 <div class="fl_left cycle-slideshow"
     data-cycle-slides=">a"
     data-cycle-timeout="15000"
     data-cycle-pause-on-hover="true"
     data-cycle-speed="500"
     >
     <a title="<?=$lang[1159]?>" href="<?=$h?>"><img src="<?=$im?>logo.jpg" > </a>
     <a title="<?=$lang[1159]?>" href="<?=$h?>p9.html"><img src="<?=$im?>logo.jpg" > </a>
 </div>

以下是文件链接:

jquery.cycle2.min.js

top.inc.php

幻灯片代码从top.inc.php

中的--LOGO ADD--开始

谢谢,S

1 个答案:

答案 0 :(得分:1)

我有一个类似的问题。基本上,无论如何我发生的事情是即使我正在按照告诉我去做的周期

.slide { display: none; }
.slide:first-of-type { display: block; }

不起作用。我发现的是,只要插入jQuery,它就将幻灯片的绝对位置添加到幻灯片中,然后再复制第一个为.cycle-sentinel,然后变成一个静态图像,为窗口提供尺寸。对我有用的是

.slide { display: none; }
.slide:first-of-type { display: block; position: static !important;}

这样,第一张幻灯片将保持静止并保持原状,直到创建.cycle-sentinel为止,此时Document query = new Document("sent", new Document("$exists", true));成为第一个幻灯片,并且无论如何它都是静态的。希望能有所帮助。

相关问题