$(document).ready(function () {

    $("#slider").owlCarousel({

        loop: true,

        navigation: false, // Show next and prev buttons

        slideSpeed: 300,

        paginationSpeed: 400,

        singleItem: true,

        autoPlay: true,

        responsive: true,

        itemsDesktop : [1199,4],

        itemsDesktopSmall : [980,3],

        itemsTablet: [768,2],

        itemsTabletSmall: false,

        itemsMobile : [479,1],

        // "singleItem:true" is a shortcut for:

        // items : 1,

        // itemsDesktop : false,

        // itemsDesktopSmall : false,

        // itemsTablet: false,

        // itemsMobile : false

    });

    $(".categories ul > li").on('click', function () {

        var hand = $(this);

        if (hand.has('ul')){

            $(".categories ul li.opened").not(this).removeClass('opened').find("ul").slideUp();

            if(hand.hasClass('opened')){

                hand.find("ul").slideUp();

            }else{

                hand.find("ul").slideDown();

            }

            hand.toggleClass('opened');

        }

    })

});