我正在使用kenwheeler的插件,光滑,我不知道为什么我的页面创建了多个幻灯片。如下面的链接,只有4个图像,但其中一个意外重复(你可以在最后看到它)。希望你能帮帮我。谢谢你们!
我的代码:
<div class="slider">
<div class="slider-for">
<!-- BEGIN: othersimg -->
<div>
<img src="{IMG_SRC_OTHER}" alt="{TITLE}" style="height:500px; width: 100%"/>
</div>
<!-- END: othersimg -->
</div>
<div class="slider-nav">
<!-- BEGIN: othersimg_thumb -->
<div><a href=""><img src="{IMG_SRC_OTHER}" style="height:80px" /></a></div>
<!-- END: othersimg_thumb -->
</div>
</div>
<style>
.slick-prev{
z-index: 99;
left:20px!important
}
.slick-next{
z-index: 99;
right:20px!important
}
</style>
<script type="text/javascript">
$( document ).ready(function(){
$('.slider-for').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: true,
fade: true,
asNavFor: '.slider-nav'
});
$('.slider-nav').slick({
slidesToShow: 7,
slidesToScroll: 1,
asNavFor: '.slider-for',
dots: false,
centerMode: false,
focusOnSelect: true
});
});
</script>
PHP代码:
if( !empty( $otherimage ) )
{
$i = 0;
foreach( $otherimage as $otherimage_i )
{
if( !empty( $otherimage_i ) and file_exists( NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $otherimage_i ) )
{
$otherimage_i = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $otherimage_i;
$xtpl->assign( 'IMG_SRC_OTHER', $otherimage_i );
$xtpl->assign( 'num_itemimg', $i );
$xtpl->parse( 'main.othersimg' );
$xtpl->parse( 'main.othersimg_thumb' );
$i++;
}
}
$xtpl->parse( 'main.othersimg' );
$xtpl->parse( 'main.othersimg_title' );
}