$(function() { "use strict"; new PerfectScrollbar('.cart-list'); // Prevent closing from click inside dropdown /*$(document).on('click', '.dropdown-menu', function (e) { e.stopPropagation(); });*/ // jquery ready start $(document).ready(function() { // jQuery code $("[data-trigger]").on("click", function(e){ e.preventDefault(); e.stopPropagation(); var offcanvas_id = $(this).attr('data-trigger'); $(offcanvas_id).toggleClass("show"); $('body').toggleClass("offcanvas-active"); $(".screen-overlay").toggleClass("show"); }); // Close menu when pressing ESC $(document).on('keydown', function(event) { if(event.keyCode === 27) { $(".mobile-offcanvas").removeClass("show"); $("body").removeClass("overlay-active"); } }); $(".btn-close, .screen-overlay").click(function(e){ $(".screen-overlay").removeClass("show"); $(".mobile-offcanvas").removeClass("show"); $("body").removeClass("offcanvas-active"); }); }); // jquery end $('.dropdown-menu a.dropdown-toggle').on('click', function(e) { if (!$(this).next().hasClass('show')) { $(this).parents('.dropdown-menu').first().find('.show').removeClass("show"); } var $subMenu = $(this).next(".dropdown-menu"); $subMenu.toggleClass('show'); $(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) { $('.submenu .show').removeClass("show"); }); return false; }); $(document).ready(function() { $(window).on("scroll", function() { $(this).scrollTop() > 300 ? $(".back-to-top").fadeIn() : $(".back-to-top").fadeOut() }), $(".back-to-top").on("click", function() { return $("html, body").animate({ scrollTop: 0 }, 600), !1 }) }), $(".btn-mobile-filter").on("click", function() { $(".filter-sidebar").removeClass("d-none") }), $(".btn-mobile-filter-close").on("click", function() { $(".filter-sidebar").addClass("d-none") }), $(".switcher-btn").on("click", function() { $(".switcher-wrapper").toggleClass("switcher-toggled") }), $(".close-switcher").on("click", function() { $(".switcher-wrapper").removeClass("switcher-toggled") }), $('#theme1').click(theme1); $('#theme2').click(theme2); $('#theme3').click(theme3); $('#theme4').click(theme4); $('#theme5').click(theme5); $('#theme6').click(theme6); $('#theme7').click(theme7); $('#theme8').click(theme8); $('#theme9').click(theme9); $('#theme10').click(theme10); $('#theme11').click(theme11); $('#theme12').click(theme12); $('#theme13').click(theme13); $('#theme14').click(theme14); $('#theme15').click(theme15); function theme1() { $('body').attr('class', 'bg-theme bg-theme1'); } function theme2() { $('body').attr('class', 'bg-theme bg-theme2'); } function theme3() { $('body').attr('class', 'bg-theme bg-theme3'); } function theme4() { $('body').attr('class', 'bg-theme bg-theme4'); } function theme5() { $('body').attr('class', 'bg-theme bg-theme5'); } function theme6() { $('body').attr('class', 'bg-theme bg-theme6'); } function theme7() { $('body').attr('class', 'bg-theme bg-theme7'); } function theme8() { $('body').attr('class', 'bg-theme bg-theme8'); } function theme9() { $('body').attr('class', 'bg-theme bg-theme9'); } function theme10() { $('body').attr('class', 'bg-theme bg-theme10'); } function theme11() { $('body').attr('class', 'bg-theme bg-theme11'); } function theme12() { $('body').attr('class', 'bg-theme bg-theme12'); } function theme13() { $('body').attr('class', 'bg-theme bg-theme13'); } function theme14() { $('body').attr('class', 'bg-theme bg-theme14'); } function theme15() { $('body').attr('class', 'bg-theme bg-theme15'); } $(".lazy").lazyload({ placeholder: "/img/grey.gif", effect: "fadeIn", failure_limit: 2, threshold: 10 }); });