// javascript document $(function(){ $(".menu li").hover(function(){ $(this).addclass("on"); $(this).children(".sub").stop(true,false).slidedown(); },function(){ $(this).removeclass("on"); $(this).children(".sub").stop(true,false).slideup(); }); $('.m_navbtn').on('click', function() { if (!$(this).hasclass('active')) { $(this).addclass('active'); $('.m-menu').slidedown(); }else{ $(this).removeclass('active'); $('.m-menu').slideup(); } }); $('.m-menu .menu_a').on('click', function() { if (!$(this).hasclass('active')) { $(this).addclass('active').parent().siblings().children('.menu_a').removeclass('active'); $(this).next('.sub').slidedown().parent().siblings().find('.sub').slideup(); }else{ $(this).removeclass('active'); $(this).next('.sub').slideup(); } }); if ($(window).width()>1024) { $('.lang').hover(function(){ $(this).children(".sub").stop(true,false).slidedown(300); },function(){ $(this).children(".sub").stop(true,false).slideup(300); }) }else{ $(".lang").on('click',function(){ $(this).find(".sub").stop(true,true).slidetoggle(); }) } $('.subscibe').on('click', function() { if (!$(this).hasclass('active')) { $(this).addclass('active'); $('.subscibe-con').fadein(); }else{ $(this).removeclass('active'); $('.subscibe-con').fadeout(); } }); $('.subscibe-con .closed').click(function(){ settimeout(function(){ $('.subscibe-con').stop().fadeout(); $('.subscibe').removeclass('active'); }, 50); }) $(".backtop").on("click",function(){ $('html, body').animate({scrolltop: 0},300);return false; }) }) $(function(){ $(window).on('scroll resize',function(){ wintop = $(window).scrolltop(); headertop = parseint($('.header').css('top')); if(wintop>headertop){ $('.header').addclass('header-scroll'); }else{ $('.header').removeclass('header-scroll'); } }) }) $(function () { $('.tab_tit a').on("click",function(){ var obj = $(this), paren = obj.parents('.i-news'); var index=$(this).index(); $(this).addclass('cur').siblings().removeclass('cur'); paren.find('.tab_news').removeclass('cur'); paren.find('.tab_news').eq(index).addclass('cur'); }) }) $(function(){ if ($(window).width()>=1024) { $(".f_link").hover(function(){ $(this).find(".sub").stop(true,true).slidetoggle(); }) }else{ $(".f_link").on('click',function(){ $(this).find(".sub").stop(true,true).slidetoggle(); }) } $(".header .serchbtn").on('click', function() { $(".search-alert").stop().fadein(300); $("body,html").addclass('ovh'); }); $(".search-alert .close").on('click', function() { $(".search-alert").stop().hide(); $("body,html").removeclass('ovh'); }); }); $(function(){ $(".banner").height($(window).height()); window.onresize = function(){ $(".banner").height($(window).height()); } }) // 纵向滚动条 function scrolly(ele) { ele.mcustomscrollbar({ axis:'y', // horizontal scrollba autohidescrollbar: true, mousewheel:{ preventdefault:false } }); } function scrolly2(ele) { ele.mcustomscrollbar({ axis:'y', // horizontal scrollba autohidescrollbar: false, mousewheel:{ preventdefault:false } }); } // 纵向滚动条 function scrollx(ele) { ele.mcustomscrollbar({ axis:'x', // horizontal scrollba autohidescrollbar: false, mousewheel:{ preventdefault:false } }); } $(document).ready(function() { $('a[href*=#]').click(function() { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { var $target = $(this.hash); $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']'); if ($target.length) { var targetoffset = $target.offset().top; $('html,body').animate({ scrolltop: targetoffset-60 }, 300); return false; } } }); });