$(function () { if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))) { new WOW({ offset: window.outerWidth>576?160:50 }).init(); }; $('#search-btn').on('click', function () { var type = $(this).attr('type'); $(this).attr('type', 'submit').css('border-width', '1px'); $('#search-key').removeClass('d-none'); return type=='submit'?true:false; }); $('#navbar').on('mouseover', '[data-shrink]', function () { var that = $(this); $('.navbar-shrink').hide(); $('#shrink-'+that.data('shrink')).slideDown(200).on('mouseleave', function () { $(this).hide(); }); }); $('#navbar').on('mouseover', 'li.dropdown', function () { var that = $(this); if (that.data('shrink')) { /*$('.navbar-shrink').hide(); $('#shrink-'+that.data('shrink')).slideDown(200).on('mouseleave', function () { $(this).hide(); });*/ } else { that.addClass('show').find('.dropdown-menu').addClass('show'); that.on('mouseleave', function () { that.removeClass('show').find('.dropdown-menu').removeClass('show'); }); } }).find('.dropdown').on('click', 'a', function () { location.href = $(this).attr('href'); }); var category = $('#category'); if (category.size() > 0) { var topnav = $('#topnav'); var navHeight = topnav.outerHeight(); var categoryTop = category.offset().top; $(window).scroll(function () { var scrollTop = $(window).scrollTop(); if (scrollTop > categoryTop) { navHeight = category.hasClass('product-nav')?0:navHeight; category.css({ position: 'fixed', top: navHeight + 'px' }); topnav.removeClass('bg-opacity'); } else { category.css({ position: 'static', top: '0px' }); topnav.addClass('bg-opacity'); } }); category.on('click','.nav-link',function(){ category.find('.nav-link').removeClass('active'); $(this).addClass('active'); }) } $('[data-toggle="tooltip"]').tooltip({ boundary: 'window' }); $('video[autoplay]').on('mouseenter',function(){ console.log(this.paused) //this.play(); }).on('mouseleave',function(){ //this.pause(); }); $('#totop').on('click',function(){ $("body,html").stop().animate({ scrollTop: 0 }); }); });