(function ($) { jQuery(document).ready(function ($) { $('body').on('click', '.open-menu', function() { $(this).addClass('active'); $('.menu-mobile').addClass('active'); $('.overlay').addClass('active'); }); $('body').on('click', '.open-menu.active', function() { $('.open-menu').removeClass('active'); $('.menu-mobile').removeClass('active'); $('.overlay').removeClass('active'); }); $('body').on('click', '.overlay', function() { $('.open-menu').removeClass('active'); $('.menu-mobile').removeClass('active'); $('.overlay').removeClass('active'); }); // ---- language ---- $('body').on('click', '.language-select', function() { var language_text = $(this).data('name'); console.log(language_text); if (language_text == 'Arabic') { $('body').attr('id', 'rtl'); }else{ $('body').removeAttr('id'); } $('.text-language span').text(language_text); }); // --- menu -- $('body').on('click', '.button-search', function() { $('.search-box').addClass('active'); }); $('body').on('click', '.close-search-form', function() { $('.search-box').removeClass('active'); }); var menu = $(".header-middle"); if (menu.length) { var sticky = menu.offset().top + 1; // if ($(window).width() > 767) { sticky_menu(menu, sticky); $(window).on('scroll', function () { sticky_menu(menu, sticky); }); // } } }); function sticky_menu(menu, sticky) { if (typeof sticky === 'undefined' || !jQuery.isNumeric(sticky)) sticky = 0; if ($(window).scrollTop() >= sticky) { if ($('#just-for-height').length === 0) { menu.after('
') } menu.addClass("sticky"); } else { menu.removeClass("sticky"); $('#just-for-height').remove(); } } })(jQuery);