$('.channel-nav li').each(function (index,item){ $(this).on('click',function (){ let tocontent = $(this).find('a').attr('data-href'); //console.log(tocontent); if(tocontent){ $.scrollto(tocontent,1000); } }) }) var app = { init:function (){ window.localstorage.clear(); glightbox(); this.win_scroll(); if (!(/msie [6|7|8|9]/i.test(navigator.useragent))){ try{ var wow = new wow(); if(wow){ new wow({ boxclass: 'wow', animateclass: 'animated', offset: 100, mobile: true, live: true }).init(); } }catch (e){ console.log(e) } }; this.header(); /*$('.paroller').paroller();*/ $('.backtop').click(function(){$("html,body").animate({scrolltop:0},1000);return false}) }, header:function () { $(".nav li").on('mouseover',function(){ let index =$(this).index(), itemcon = $(".nav-container .child-item"), currentcon = $(".nav-container .item-"+ index); let cc = $(".nav-container .item-"+ index).addclass('333'); if(!$(this).hasclass('no-dropdown')){ $(this).addclass('active').siblings().removeclass('active'); itemcon.removeclass('active'); currentcon.addclass("active"); currentcon.find(".animate-nav").each(function( index ) { $( this ).addclass("animated fadeinup").css({'animation-delay': (index/10)+'s'}); }); $(this).parents(".header").addclass('hover'); $(".dropdown-nav").stop().slidedown(); var header_height = $('.header').outerheight(true); $(".mask").css({'top':header_height}).fadein(300); } else{ $(".header").removeclass("hover"); $(".dropdown-nav").stop().slideup(function (){ $(".child-item").removeclass('active'); }); } }) $(".header").on("mouseleave",function (){ $(this).removeclass("hover"); $(".dropdown-nav").stop().slideup(function (){ $(".child-item").removeclass('active'); }); $(".mask").fadeout(300); }) $(window).resize(function (){ var win_width = window.outerwidth; if(win_width < 1400){ $(".dropdown-nav").stop().slideup(); } }); }, win_scroll:function(){ var position=0,scrolltop=0; if($(".location-box").size() > 0){ var locationtop = $(".location-box").offset().top; } $(window).scroll(function () { scrolltop = $(window).scrolltop(); if(scrolltop > 1){ $('.header').addclass('header-min'); }else{ $('.header').removeclass('header-min'); } if(window.outerwidth > 992){ if (scrolltop > position) { if(!$(".header").hasclass('open-menu')){ $(".header").addclass('scroll_bottom'); } } else { $(".header").removeclass('scroll_bottom'); } if(scrolltop < locationtop){ $(".location-box").removeclass('scroll-up'); $(".location-box").hasclass('fixed-top') ? $(".location-box").removeclass('fixed-top') : ''; }else{ $(".location-box").hasclass('fixed-top') ? '' : $(".location-box").addclass('fixed-top'); if (scrolltop > position) { $(".location-box").removeclass('scroll-up'); } else { $(".location-box").addclass('scroll-up'); } } settimeout(function() { position = scrolltop; }, 0); } /* let location_top = $(".location-box").offset().top; console.log(location_top) if(scrolltop >= location_top){ $(".location-box").addclass('fixed-top'); }else{ console.log('eee'); $(".location-box").removeclass('fixed-top'); }*/ }); }, index:function (){ } } $(function (){ app.init(); })