$(function(){ $(".nav").hover(function(){ return }, function(){ $(".sub").stop(true,true).slideup(500); if($(".nav .li.cur").length){ navline($(".nav .li.cur").index()) }else{ $(".nav-line").stop().animate({ width : 0, left : 0 }, 600) } }) $(".n-banner .down").on("click",function(){ $('html,body').animate({ scrolltop : $(".n-banner").height() },600, 'easeinoutquad'); return false; }) if ($(".n-banner").length>0) { $("body").addclass("header-por"); $(".header").addclass("active"); } if ($(window).width()<767) { $(".bus-list2 .tabul img").each(function(){ var stra = ""; $(this).wrapall(stra); }) $(".bus-list5 .text .right,.bus-list14 .img2 img,.bus-list16 .imgbox img,.bus-list15 .tabul .img1,.bus-list9 .img img").each(function(){ var stra = ""; $(this).wrapall(stra); }) } // var _id = geturlparam('id'); // if(_id){ // settimeout(function(){ // //有二级导航的 // $('.header2 .nav .sec-list a,.n-subbox .subnav a').eq(_id).click(); // //没有二级导航,用animate,移动高度 // if ($(window).width()>1024) { // $('html,body').stop().animate({scrolltop:$('.position').eq(_id).offset().top},500); // }else{ // $('html,body').stop().animate({scrolltop:$('.position').eq(_id).offset().top - $("header").height() + $(".warp-subbox").height()},500); // } // },1000) // } if ($(".por-number").length>0) { var isplay=true; $(window).on('scroll',function(){ if($(window).scrolltop()+$(window).height()*.5>$(".por-number").offset().top&&isplay){ isplay=false; $('.num-item').each(function(index,el){ $(el).find('.num').leotextanimate({ fixed:[',',':','.','-','~'], start:'0', delay: 1000 }); }) } }) } if ($(".por-number2").length>0) { var isplay2=true; if($(window).scrolltop()+$(window).height()*.5>$(".por-number2").offset().top&&isplay2){ isplay2=false; $('.num-item2').each(function(index,el){ $(el).find('.num2').leotextanimate({fixed:[',',':','.','-','~'],start:'0',delay: 1000}); }) } } scrollani(); visual_button_scroll_down(); }); function visual_button_scroll_down(){ $('.scroll_down').on('click',function(){ var target = $(this).attr('href'); var target_top = $(target).offset().top; $('html,body').animate({ scrolltop : target_top },600, 'easeinoutquad'); return false; }); } function imgerrorfun(){ var img=event.srcelement; img.src=static_url +"web/img/img14-1.jpg"; img.onerror=null; } function scrollani() { $('.js-m').each(function() { var _this = $(this); if (_this.offset().top > $(window).scrolltop() + $(window).height() || _this.offset().top < $(window).scrolltop() - _this.outerheight()) { // _this.removeclass('animate'); } else if ($(window).scrolltop() > _this.offset().top - $(window).height() * 0.9) { _this.addclass('animate'); } }); $(window).scroll(function() { $('.js-m').each(function() { var _this = $(this); if (_this.offset().top > $(window).scrolltop() + $(window).height() || _this.offset().top < $(window).scrolltop() - _this.outerheight()) { // _this.removeclass('animate'); } else if ($(window).scrolltop() > _this.offset().top - $(window).height() * 0.9) { _this.addclass('animate'); // $(_this) // startscramble('.i-img-list.animate .home-dec'); // startscramble('.i-lista.animate .home-dec'); } }); }); } function navline(n){ var w = 0; for (var i = 0; i < n; i++) { w = w + $(".nav .li").eq(i).find("a").outerwidth() }; $(".nav-line").stop().animate({ width : $(".nav .li").eq(n).find("a").outerwidth(), left : w }, 600) } function geturlparam(name){ var reg = new regexp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r!=null) return unescape(r[2]); return null; }