$(function () { // 加载动画 if (__m.cssanimations) { new kyanimate().init(); } else { $(".ky").css("visibility", "visible"); } $('.links .text-show').click(function () { $('.links .link').stop(false, true).slidetoggle(388); }) $('.sub').click(function () { $('header .box .nav').css("overflow", "hidden") $('.search').addclass('open') $('nav').addclass('open') }) $__w.click(function (e) { $this = $(e.target); if (!$(".links .link").is(":hidden") && !$this.hasclass("text-show") && !$this.hasclass("text") && !$this.hasclass("icon")) { $(".links .link").stop(false, true).hide(388, "easeinquart"); } if (!$(".search-inputbox .text").is(":hidden") && !$this.hasclass("sub") && !$this.hasclass("text")) { $('.search').removeclass('open') $('nav').removeclass('open') window.settimeout(function () { $('header .box .nav').css("overflow", "inherit") }, 489); } }); $(".nav-box nav ul li").hover(function () { $t = $(this); $obj = $t.find(".down-box"); $obj.css({ "left": -$t.offset().left + "px", "width": $("body").width() }); if ($isloser) { $obj.show(); } else { $obj.stop(true, false).slidedown(388, "easeinquart"); // $('header').stop(true, false).addclass('open1'); } }, function () { $(this).find('.down-box').stop(true, false).slideup(388, "easeoutquart"); // $('header').stop(true, false).removeclass('open1'); }); $(".subsidiary").hover(function () { $t = $(this); $obj = $t.find(".conceal"); $obj.css({ "left": -$t.offset().left + "px", "width": $("body").width() }); if ($isloser) { $obj.show(); } else { $obj.stop(true, false).slidedown(388, "easeinquart"); // $('header').stop(true, false).addclass('open1'); } }, function () { $obj.stop(true, false).slideup(388, "easeoutquart"); // $('header').stop(true, false).removeclass('open1'); }); $(".pc-header").hover(function () { $(this).data("state",1) if ($(document).scrolltop() == 0) { $(this).addclass('open1'); } }, function(){ $(this).data("state",0) $(this).removeclass('open1'); } ) if ($(document).scrolltop() > 0) { $('header').addclass('open'); $('.conceal').addclass('open'); } $(window).scroll(function () { if ($(document).scrolltop() > 0) { $('header').addclass('open'); $('.conceal').addclass('open'); $(".pc-header").removeclass('open1'); } else { $('header').removeclass('open'); $('.conceal').removeclass('open'); if($(".pc-header").data("state") == "1"){ // $(".pc-header").data("state",0) $(".pc-header").addclass('open1'); } }; }); $(".return").on("click", function () { $("html,body").animate({ scrolltop: 0 }, 800); }); $(".down-box .box-right .list .item").hover( function () { var index = $(this).index(); $(".down-box .box-right .list .item-bg").css({ 'top': index * 0.525 + 'rem' }); }, function () { $(".down-box .box-right .list .item-bg").css({ 'top': '-0.525rem' }); } ); if($(window).width() < 1004){ $('.m-header .home').click(function(){ $('.m-header .down-nav').toggleclass('mobile-open'); $('.m-header .home').toggleclass('home-close'); $('.m-header .search').toggle() $('.mobile-mask').fadetoggle(300); if($('body').hasclass('fixed')){ $('body').removeclass('fixed'); $('body').removeattr("style"); $(window).scrolltop(top); }else{ top = $(window).scrolltop(); $('body').css("top", -top + "px"); $('body').addclass('fixed'); } if($('.down-nav .box nav ul li').hasclass('li-open')){ $('.down-nav .box nav ul li').removeclass('li-open'); } }) $(".mobile-mask").click(function(){ $('.m-header .down-nav').removeclass('mobile-open'); $('.m-header .home').removeclass('home-close'); $('.m-header .search').hide(); if($('body').hasclass('fixed')){ $('body').removeclass('fixed'); $('body').removeattr("style"); $(window).scrolltop(top); } if($('.down-nav .box nav ul li').hasclass('li-open')){ $('.down-nav .box nav ul li').removeclass('li-open'); } }) $('.down-nav .box nav ul li').click(function(){ $(this).addclass('li-open').siblings().removeclass('li-open'); }) $('.m-header .search').click(function(){ $('.m-header .search-box').stop().slidetoggle() }) } if($(window).width() > 1004){ $(".pc-header").stop().fadeto(1188,1,"easeoutquint"); } if($(window).width() < 1004){ if($('.inner-nav').length > 0){ var width = $('.inner-nav nav ul li').eq(0).width(); var length = $('.inner-nav nav ul li').length; var index = $('.inner-nav nav ul li.active').index(); $('.inner-nav nav ul').css('width',width * length + 10); var left = $('.inner-nav nav ul li.active').offset().left; if((length - index) <= 2){ $(".inner-nav nav").stop().animate({ scrollleft:left }); if(length <= 3){ $(".inner-nav nav").stop().animate({ scrollleft:left }); } }else{ $(".inner-nav nav").stop().animate({ scrollleft:(left - 120) }); } } } });