//business coverage page scroll effect jQuery(function ($) { var navH = $(".block-menu-search").height(); if($(".contry-content").length > 0){ var navH1 = $(".contry-content").offset().top; var navW = $(".country-nav").outerWidth(); $(".country-nav ul li a").each(function(index,item){ $(this).bind("click",function(e){ $('html, body').animate({ scrollTop: navigator.userAgent.match(/mobile/i)?$("a[name='"+$(this).attr("href")[1]+"']").offset().top:($("a[name='"+$(this).attr("href")[1]+"']").offset().top-navH-20) }, 1000); }) }); if(!navigator.userAgent.match(/mobile/i)) { $(window).scroll(function(){ var scroH = $(this).scrollTop(); var offset = 80; if(scroH>=(navH1-offset-navH)){ $(".country-nav").addClass("fixed"); $(".country-nav").css({"top":(navH+offset),"padding-left":($(".contry-content").width()+30),"padding-right":navW}); }else{ $(".country-nav").removeClass("fixed"); $(".country-nav").css({"top":0,"padding-left":0,"padding-right":0}); } }); } else{ $(".country-nav").remove(); $(document.body).append("
"); $(".contry-content").width(function(){ console.log($(window).width() - $(".country-nav-m").outerWidth() -10); return ($(window).width() - $(".country-nav-m").outerWidth() -40); }); $(".country-nav-m ul li a").each(function(index,item){ $(this).bind("click",function(e){ $('html, body').animate({ scrollTop: $("a[name='"+$(this).attr("href")[1]+"']").offset().top }, 1000); }) }); $(window).scroll(function(){ if($(this).scrollTop()>$(".contry-content").offset().top){ $(".country-nav-m").css({"transition":"all 500ms","opacity":"1"}); $("#toTop").css("display","none"); } else{ $(".country-nav-m").css("opacity","0"); } }); } } var mobile_flag = isMobile(); if(mobile_flag){ $("#block-bottome .position-bottomu").hide(); } var i=0; var imgLi=$("#gongyi .img li"); var numLi=$("#gongyi .num li"); var gongYi=$("#gongyi"); //鎵嬪姩鎺у埗 imgLi.first().show(); numLi.hide(); numLi.mouseover(function () { $(this).addClass("active").siblings().removeClass("active"); var index=$(this).index(); i=index; imgLi.eq(index).stop().fadeIn(300).siblings().stop().fadeOut(300); }); var gYt=setInterval(move,5000); //瀹氭椂鍣ㄦ殏鍋滃拰鎭㈠ gongYi.hover(function () { numLi.stop().show(); clearInterval(gYt); },function () { numLi.stop().hide(); gYt=setInterval(move,5000); }); //宸﹀彸鎸夐挳鐐瑰嚮浜嬩欢 $("#gongyi .left").click(function () { moveL(); }); $("#gongyi .right").click(function () { move(); }); //鍚戝彸杩愬姩鏂规硶 function move() { i++; if(i==9){i=0;} numLi.eq(i).addClass("active").siblings().removeClass("active"); imgLi.eq(i).stop().fadeIn(300).siblings().stop().fadeOut(300); } function moveL() { i--; if(i==-1){i=8;} numLi.eq(i).addClass("active").siblings().removeClass("active"); imgLi.eq(i).stop().fadeIn(300).siblings().stop().fadeOut(300); } function isMobile() { var userAgentInfo = navigator.userAgent; var mobileAgents = [ "Android", "iPhone", "SymbianOS", "Windows Phone", "iPad","iPod"]; var mobile_flag = false; //鏍规嵁userAgent鍒ゆ柇鏄惁鏄墜鏈 for (var v = 0; v < mobileAgents.length; v++) { if (userAgentInfo.indexOf(mobileAgents[v]) > 0) { mobile_flag = true; break; } } var screen_width = window.screen.width; var screen_height = window.screen.height; //鏍规嵁灞忓箷鍒嗚鲸鐜囧垽鏂槸鍚︽槸鎵嬫満 if(screen_width < 500 && screen_height < 800){ mobile_flag = true; } return mobile_flag; } });