Why doesn’t my owl slider shows up?

I’m having an issue with integrating owl-slider with a WordPress theme. The slider should get the featured image of the latest 4 posts, with the title and a small description. The problem is the output owl-slider shows up in the inspector but as a white-div and nothing else,

A screenshot of the issue: http://i.imgur.com/jKKt8Qx.png

Read More

The code of the loop:

<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>

The function is being called with this code in the footer:

<script>
    ;(function($){
        $("#owl-slider").owlCarousel({
            autoPlay: true,
            navigation : true, // Show next and prev buttons
            slideSpeed : 300,
            pagination : false,
            singleItem : true
        });
    })(jQuery);
</script>

Related posts

Leave a Reply

2 comments

  1. Try to wrap the JS code in document.ready like this, maybe it will work as I couldn’t find anything that could cause the error.

    ;(function($){
    $(document).ready(function() {
        $("#owl-slider").owlCarousel({
            autoPlay: true,
            navigation : true, // Show next and prev buttons
            slideSpeed : 300,
            pagination : false,
            singleItem : true
        });
    });
    })(jQuery);