rem*_*i90 4 wordpress jquery jcarousel
我正在尝试做的是让我的滑块连续循环通过LI,而不是滚动直到它到达最后一个项目然后停止(这是它当前所做的).
以下代码来自Wordpress站点,因此虽然它只显示一个LI,但实际上在前端输出了大约6或7个:
PHP
<ul id="slideshowContainer" class="jcarousel jcarousel-skin-tango">
<?php $clientLogos = new WP_Query(array('post_type' => 'client-logos', 'posts_per_page' => -1)); ?>
<?php while ($clientLogos->have_posts() ) : $clientLogos->the_post(); ?>
<li>
<?php if (has_post_thumbnail( $post->ID )): ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); ?>
<img src="<?php bloginfo('template_directory'); ?>/thumbs.php?src=<?php echo $image[0]; ?>&h=100&zc=1" alt="<?php the_title(); ?>" />
<?php endif; ?>
</li>
<?php endwhile;?>
<div style="clear:both"></div>
</ul>
Run Code Online (Sandbox Code Playgroud)
JS
jQuery(document).ready(function() {
jQuery('#slideshowContainer').jcarousel({
scroll: 1,
auto: .01,
wrap: 'last',
easing: 'linear'
});
});
Run Code Online (Sandbox Code Playgroud)
谢谢!
小智 7
使用'wrap'选项.使用以下作为示例:
$('.jcarousel')
.jcarousel({
wrap: 'circular'
})
.jcarouselAutoscroll({
interval: 3000,
target: '+=1',
autostart: true
});
Run Code Online (Sandbox Code Playgroud)