我正在使用 flexslider 创建一个滚动的帖子文本滑块,您可以通过 flex-nav-control li 'tabs' 来控制它。它与我想要的非常接近,但是我需要 flex-nav-control li 'tabs' 将用户带到幻灯片的顶部。有没有办法做到这一点?
PHP
<?php /* Start the Loop */ ?>
<?php
$currentID = get_the_ID();
$args = new WP_Query(
array(
'post_type' => 'post',
'post_status' => 'publish',
'post__not_in' => array($currentID),
'posts_per_page' => 1000,
)
); ?>
<?php if($args->have_posts()) : ?>
<div class="row">
<div class="col-md-4 col-12">
<div class="flexslider-controls">
<ol class="flex-control-nav">
<?php while($args->have_posts()) : $args->the_post(); ?>
<li> <?php the_title(); ?></li>
<?php endwhile; ?>
</ol>
</div>
</div>
<div class="col-md-8 col-12" style="padding-top: 35px; padding-left: 4em;">
<div class="flexslider">
<ul class="slides">
<?php while($args->have_posts()) : $args->the_post(); ?>
<li>
<div class="slide-container">
<h4><?php the_title(); ?></h4>
<?php the_content(); ?>
</div>
</li>
<?php endwhile; ?>
</ul>
</div>
<?php endif; wp_reset_query(); ?>
JS
jQuery(document).ready(function($){
var $flexslider = $(".flexslider");
$flexslider.flexslider({
animation: "slide",
manualControls: ".flex-control-nav li",
useCSS: false /* Chrome fix*/,
});
});