$(".navbar-burger").click(function () { $(".navbar-burger").toggleClass("is-active"); $(".navbar-menu").toggleClass("is-active"); }); function getWindowWidth(){ return $(window).width(); } $(window).resize(function (){ getWindowWidth(); }); getWindowWidth(); function setNavBarBg() { var wst = $(window).scrollTop(); var tHeight = $('#header').height(); if (wst <= tHeight) { $('.go-top').hide(); $('#header').css({'height':'5.5rem'}).addClass('pr-5 pl-5').removeClass('pr-3 pl-3'); $('.logo-box').removeClass('logo-box-active'); } else { $('.go-top').show(); if (getWindowWidth() > 768){ $('#header').css({'height':'4.6rem'}).removeClass('pr-5 pl-5').addClass('pr-3 pl-3'); } $('.logo-box').addClass('logo-box-active'); } } $(window).scroll(function () { setNavBarBg(); }); setNavBarBg(); $(document).ready(function () { $('#header .navbar-dropdown a').each(function () { if($(this).hasClass('m_active')){ $(this).parent('div').prev('a').addClass('active'); } }); }); $('.go-top').click(function () { $("html,body").stop().animate({ scrollTop: 0 }, 500); return false; }); $('#my-seach').click(function () { $('#search-box').toggle(); }); $('.search-btn').click(function () { if ($('.search-input').val() == ''){ return false; } window.location.href='/search/'+$('.search-input').val()+'.html'; });