2

我在我的 Wordpress 主题上与 Caroufredsel 合作,其中每个项目都链接到一个帖子(这个轮播总是在这个帖子的顶部。

目前,我的轮播以随机顺序开始,当前具有“ativo”类的项目如何成为第一个开始?

这是我的js:

$("#modelos_slider_interna").carouFredSel({
    swipe       : true,
    auto        : false,
    items       : {
        height      : 175,
        width       : "variable",
        start       : "random",
    },
    prev : "#modelos_slider_interna_volta",
    next : "#modelos_slider_interna_vai",
    scroll: 1,

});

这是php:

   <div class="modelos_slider_interna">
      <div id="modelos_slider_interna">
<?php

    global $wp_query;
    $args = array( 'post_type' => 'barco', );
    $loop = new WP_Query( $args );
    $current_id = $wp_query->get_queried_object_id();
    while ( $loop->have_posts() ) : $loop->the_post();
            echo "<div class='modelos_itens_interna ". ( $current_id == $post->ID ? 'ativo' : '' ) ."'><a href='".get_permalink()."'><div class='fader'>";
            $carrosel = rwmb_meta( 'meta_barco_carrosel', 'type=plupload_image&size=');

            foreach ( $carrosel as $thumb )
               {
                  echo "<img src='".get_bloginfo('template_directory')."/inc/timthumb.php?src={$thumb['url']}&h=102&w=175' width='175' height='102' alt='{$thumb['alt']}' />";
               };

            echo "</div>";

            the_title( '<h3>', '</h3>' );

            echo"</a></div>";

    endwhile; ?>
</div>
      <div class="clearfix"></div>
      <a class="prev" id="modelos_slider_interna_volta" href="#"><span>prev</span></a> <a class="next" id="modelos_slider_interna_vai" href="#"><span>next</span></a> </div>
  </div>
4

1 回答 1

1

根据文档http://docs.dev7studios.com/caroufredsel-old/configuration.php#items_object,只需替换以下行:

start       : "random",

至:

start       : $("#modelos_slider_interna div.ativo"),
于 2014-01-05T00:15:25.523 回答