我正在使用jQuery Cycle 2在此处创建滑块。
这是我正在使用的代码:
<div class="cycle-slideshow"
data-cycle-fx="fade"
data-cycle-timeout="5000"
data-cycle-pager="#custom-pager"
data-cycle-pager-template="<strong><a href=#> {{slideNum}} </a></strong>"
data-cycle-slides="> div"
>
<div>
<div class="cycle-pager"></div>
<img src="http://slp.opteradev.com/images/uploads/sliders/Purple_Pixie%C2%AE_Loropetalum-_Carmen_Favorite.jpeg" alt="Carmen’s Favorites photographs" class="img-responsive" />
<p class="slider-caption"><p><strong>1. Purple Pixie® Loropetalum</strong></p>
<p>A garden favorite of many, Purple Pixie® Loropetalum is an excellent choice for a versatile, dwarf size, weeping loropetalum. You can use Purple Pixie as a groundcover, hanging basket, or a window box. This loropetalum offers rich purple foliage and, in spring, features showy magenta ribbon-like blooms. </p></p>
</div>
<div>
<div class="cycle-pager"></div>
<img src="http://slp.opteradev.com/images/uploads/sliders/Flirt%E2%84%A2_Nandina_-_Carmen_Favorite.jpeg" alt="Carmen’s Favorites photographs" class="img-responsive" />
<p class="slider-caption"><p><strong>2. Flirt™ Nandina</strong></p>
<p>Flirt™ Nandina features stunning, deep red new growth that accentuates the evergreen leaves. One of the best things about Flirt is that it keeps its beautiful color throughout summer unlike similar varieties. This nandina can be used as an accent, container planting, or a mass planting. </p></p>
</div>
<div>
<div class="cycle-pager"></div>
<img src="http://slp.opteradev.com/images/uploads/sliders/Mojo%C2%AE_Pittosporum_-_Carmen_Favorite.jpeg" alt="Carmen’s Favorites photographs" class="img-responsive" />
<p class="slider-caption"><p><strong>3. Mojo® Pittosporum</strong></p>
<p>Mojo® Pittosporum offers so many great attributes. In the spring, its lovely dense green and yellow foliage is accompanied by orange blossom scented blooms. Mojo® is perfect for foundation plantings and hedges – and thrives well in coastal areas too! In addition, Mojo® is heat tolerant, drought tolerant and water-wise. </p></p>
</div>
<div>
<div class="cycle-pager"></div>
<img src="http://slp.opteradev.com/images/uploads/sliders/Bronze_Beauty%E2%84%A2_Cleyera_-_Carmen_Favorite.jpeg" alt="Carmen’s Favorites photographs" class="img-responsive" />
<p class="slider-caption"><p><strong>4. Bronze Beauty™ Cleyera</strong></p>
<p>What a beauty! Bronze Beauty™ Cleyera makes an ideal hedge with its rich bronze and green foliage and uniform look. Bronze Beauty isn't hard to please – it enjoys sun or shade and is heat tolerant. </p></p>
</div>
</div><!-- /.cycle-slideshow -->
我遇到的问题是,因为我使用div元素而不是img作为幻灯片对象,所以寻呼机代码(也包含在div中)被视为幻灯片元素,并显示为序列中的最后一张幻灯片,而不是作为寻呼机元素。
我在这里查看了传呼机上的信息,但没有看到关于我的特殊情况的任何信息。
在解决此问题方面的任何帮助,我将不胜感激。
看一下链接的示例,问题在于,在选择slide元素时,您需要更加具体。data-cycle-slides="> div"
选择包括您的寻呼机的滑块的子div。您可以通过在幻灯片元素中添加一个类,然后像这样选择它们来解决此问题:data-cycle-slides="div.slide"
。将寻呼机移到滑块之外也可以。
在您的问题中包含的html代码中,每张幻灯片中都错误地包含了寻呼机。您只需要在滑块中包含一次即可,而不是实际的滑块元素。
这是一个例子:
<div class="cycle-slideshow"
data-cycle-fx="fade"
data-cycle-timeout="5000"
data-cycle-pager="#custom-pager"
data-cycle-pager-template="<strong><a href=#>{{slideNum}}</a></strong>"
data-cycle-slides="div.slide"
>
<!-- empty element for pager links -->
<div id="custom-pager"></div>
<div class="slide"><img src="http://malsup.github.io/images/p1.jpg"></div>
<div class="slide"><img src="http://malsup.github.io/images/p2.jpg"></div>
<div class="slide"><img src="http://malsup.github.io/images/p3.jpg"></div>
<div class="slide"><img src="http://malsup.github.io/images/p4.jpg"></div>
</div>
这是一个小提琴。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句