(function ($) {
    $(document).ready(function(){
    if($('.block-crossreading').length){
        $('.block-crossreading').each(function(index, element){
            if($(element).find('.grid-item').length > 2){
                $(element).find('.slider').addClass('owl-carousel');

                // Init Class custom
                var $slider = $(element).find('.owl-carousel');
                var $prev = $(element).find('.owl-prev');
                var $next = $(element).find('.owl-next'); 

                // Init Addons     
                addons_int = {
                    onInitialized: function(e){
                        manageNavigationDisplay(e, $prev, $next);
                        attachCustomNavEvents($slider, $prev, $next);
                        updatePagination(e, $prev, $next);
                    },
                    onTranslate : function(e){
                        manageNavigationDisplay(e, $prev, $next);
                        updatePagination(e, $prev, $next);
                    }
                }

                // Merge options + addons
                var config_slider = $.extend({
                    responsive: {
                        0: {
                            items: 1,
                            margin: 0
                        },
                        1200: {
                            items: 2
                        }
                    },
                    nav: false,
                    smartSpeed: 1000,
                    mouseDrag: false
                }, addons_int);

                // Build Slider
                $slider.owlCarousel(config_slider);
            }
        });      
    }
});
}(jQuery));