(function($) {
    $(document).ready(function() {
        $(".owl-carousel").owlCarousel({
            navigation : true,
            pagination: false,
            slideSpeed : 300,
            paginationSpeed : 400,
            singleItem: true,
            autoPlay: true,
            stopOnHover: true,
            afterAction: function(){
                if ( this.itemsAmount > this.visibleItems.length ) {
                    $('.owl-next').show();
                    $('.owl-prev').show();

                    $('.owl-next').removeClass('disabled');
                    $('.owl-prev').removeClass('disabled');
                    if ( this.currentItem == 0 ) {
                        $('.owl-prev').addClass('disabled');
                    }
                    if ( this.currentItem == this.maximumItem ) {
                        $('.owl-next').addClass('disabled');
                    }

                } else {
                    $('.owl-next').hide();
                    $('.owl-prev').hide();
                }
            }
        });
    });
})(jQuery);