
$(function(){
 


    /*---------------------------
       Commons Variables
    ------------------------------ */
    var $window = $(window),
        $body = $("body");



 
        var $offCanvasToggle = $(".jsmenubtn03"),
            $offCanvas = $(".offcanvas"),
            $offCanvasOverlay = $(".offcanvas-overlay"),
            $mobileMenuToggle = $(".mobile-menu-toggle");

        $offCanvasToggle.on("click", function(e) {
            e.preventDefault();   

            if($(this).hasClass("active"))    {
                closemobi03();

            } else{
                $body.addClass("offcanvas-open");
                $offCanvasToggle.addClass("active");
                $offCanvas.addClass("offcanvas-open");
                $offCanvasOverlay.fadeIn();
            }
           

        });

        $(".jsmenubtn03close,.offcanvas-close, .offcanvas-overlay").on("click", function(e) {
            e.preventDefault();
             closemobi03();
            
        });

        function closemobi03(){

            $body.removeClass("offcanvas-open");
            $offCanvasToggle.removeClass("active");
            $offCanvas.removeClass("offcanvas-open");
            $offCanvasOverlay.fadeOut();

        }
   

    /*----------------------------------
        Off Canvas Menu
    -----------------------------------*/
    function mobileOffCanvasMenu() {
        var $offCanvasNav = $(".offcanvas-menu, .overlay-menu"),
            $offCanvasNavSubMenu = $offCanvasNav.find(".sub-menu");

        /*Add Toggle Button With Off Canvas Sub Menu*/
        $offCanvasNavSubMenu.parent().prepend('<span class="menu-expand"></span>');

        /*Category Sub Menu Toggle*/
        $offCanvasNav.on("click", "li a, .menu-expand", function(e) {
            var $this = $(this);
            if ($this.attr("href") === "#" || $this.hasClass("menu-expand")) {
                e.preventDefault();
                if ($this.siblings("ul:visible").length) {
                    $this.parent("li").removeClass("active");
                    $this.siblings("ul").slideUp();
                    $this.parent("li").find("li").removeClass("active");
                    $this.parent("li").find("ul:visible").slideUp();
                } else {
                    $this.parent("li").addClass("active");
                    $this.closest("li").siblings("li").removeClass("active").find("li").removeClass("active");
                    $this.closest("li").siblings("li").find("ul:visible").slideUp();
                    $this.siblings("ul").slideDown();
                }
            }
        });
    }
    mobileOffCanvasMenu();


   


     
})