我在集成貓頭鷹滑塊和WordPress主題時遇到了問題。該滑塊應該可以得到最新4篇文章的精選圖片,標題和一個小說明。問題是輸出owl-slider
顯示出來的檢查,但作爲一個白格,沒有別的,爲什麼我的貓頭鷹滑塊不顯示?
問題的截圖:http://i.imgur.com/jKKt8Qx.png
循環的代碼:
<div class="SlideShow">
<div id="owl-slider" class="owl-carousel owl-theme">
<?php
$the_query = new WP_Query('posts_per_page=4');
while ($the_query->have_posts()) : $the_query->the_post();
?>
<div class="item">
<?php the_post_thumbnail('full'); ?>
<div class="caption">
<a href="<?php the_permalink(); ?>">التفاصيل</a><!--More Link-->
<div class="innercapt">
<h1><?php the_title(); ?></h1><!--Title-->
<p><?php echo excerpt(9);?></p><!--Description-->
</div>
</div>
</div>
<?php endwhile;
// Reset Post Data
wp_reset_postdata(); ?>
</div>
</div>
的函數被調用這個代碼在頁腳:
<script>
;(function($){
$("#owl-slider").owlCarousel({
autoPlay: true,
navigation : true, // Show next and prev buttons
slideSpeed : 300,
pagination : false,
singleItem : true
});
})(jQuery);
</script>
你需要調用貓頭鷹旋轉木馬功能的DOM元素被創建後,並確定他們沒有隱藏。你甚至還打電話給Carousel功能? – brance
@brance更新了問題,請檢查它。 – 99teko
你能發佈一個鏈接到你的頁面,因爲我看不到任何代碼問題。似乎旋轉木馬無法正確計算滑塊的寬度和高度,但我不能100%確定是否存在問題。 – brance