(function() { jQuery(function($) { /* Off-Canvas */ var trigger = $('.hamburger'), icon = $('.hamburger-icon'), overlay = $('.overlay'), isClosed = false; trigger.click(function () { hamburger_trigger(); }); function hamburger_trigger() { if (isClosed == true) { overlay.hide(); icon.removeClass("fa-times"); icon.addClass("fa-bars"); isClosed = false; } else { overlay.show(); icon.removeClass("fa-bars"); icon.addClass("fa-times"); isClosed = true; } } overlay.click(function () { trigger.click(); }); $('[data-toggle="offcanvas"]').click(function () { $('#wrapper').toggleClass('toggled'); }); }); })();