// JavaScript Document $(document).ready(function(){ headHover(); function headHover(){ var h = $("#c-header"); var aLi = $("#c-header .c-nav li"); var aItem1 = $("#c-header .c-nav li .c-list1 .c-item"); var aItem2 = $("#c-header .c-nav li .c-list2 .c-item"); var num = 0; h.hover(function(){ $(this).addClass("c-head-hide"); },function(){ if($(window).scrollTop()<50 && $("#c-placeholder").length==0){ $(this).removeClass("c-head-hide"); } }); aLi.hover(function(){ $(this).find(".c-list-box").css({"display":"block","opacity":"0"}); $(this).find(".c-list-box").stop().animate({"top":"82px","opacity":"1"},500); },function(){ if($("#c-placeholder").length==0 && $(window).scrollTop()<50){ $(this).find(".c-list-box").stop().animate({"top":"100px","opacity":"0"},500,function(){ $(this).css({"display":"none"}); }); }else{ $(this).find(".c-list-box").stop().animate({"top":"82px","opacity":"0"},500,function(){ $(this).css({"display":"none"}); }); } }); fn1(); aItem1.hover(function(){ num = $(this).index(); fn1(); }); function fn1(){ aItem1.removeClass("active"); aItem1.eq(num).addClass("active"); aItem2.removeClass("active"); aItem2.eq(num).addClass("active"); } }; // 瀵艰埅鏄剧ず navFade(); function navFade(){ var i = $(window).scrollTop(); var obj = $("#c-header"); $(window).scroll(function(){ if($(this).scrollTop()>i && $(this).scrollTop()>50){ i = $(this).scrollTop(); obj.addClass("c-head-move"); }else{ i = $(this).scrollTop(); obj.removeClass("c-head-move"); } }); } // 椤甸潰婊氬姩闅愯棌瀵艰埅 isScroll(); function isScroll(){ var i = $(window).scrollTop(); var obj = $("#c-header"); if($("#c-placeholder").length!=0){ obj.addClass("c-head-hide"); }else{ fn1(); $(window).scroll(function(){ i = $(this).scrollTop(); fn1(); }); } function fn1(){ if(i>50){ obj.addClass("c-head-hide"); }else{ obj.removeClass("c-head-hide"); } } } join(); function join(){ var aLi = $("#c-join3 .c-list2>li"); aLi.each(function(){ var This = $(this); $(this).find(".c-title-box").click(function(){ This.toggleClass("active"); This.find(".c-text-wrap").stop().slideToggle(); }); }); } //鎵嬫満绔鑸 var windoww = $(window).width(); $('.sp_nav').click(function () { $('.sp_nav').toggleClass('sp_nav_se'); $('.sjj_nav').toggleClass('nav_show'); }); $('.sjj_nav ul li i').click(function () { $(this).parent().children('ul').slideToggle().parent().siblings().children('ul').slideUp(); $(this).toggleClass('sjj_nav_i_se'); $(this).parent().siblings().find('i').removeClass('sjj_nav_i_se'); }); $('.sp_nav_xjb').html(' '); //placeholder 鍏煎ie 寮€濮 if (isLowIE()) { $("input").each(function (index, item) { var placeholder = $(this).attr("placeholder"); $(this).val(placeholder); }) } //placeholder 鍏煎ie 缁撴潫 }) function isLowIE() { if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/7./i) == "7.") { return true; } else if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/8./i) == "8.") { return true; } else if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i) == "9.") { return true; } else if (navigator.appName == "Microsoft Internet Explorer") { return true; } else { return false; } } $(function(){ $(".pimg").click(function(){ var _this = $(this); imgShow("#outerdiv", "#innerdiv", "#bigimg", _this); }); }); function imgShow(outerdiv, innerdiv, bigimg, _this){ var src = _this.attr("data-img"); $(bigimg).attr("src", src); $("").attr("src", src).load(function(){ var windowW = $(window).width(); var windowH = $(window).height(); var realWidth = this.width; var realHeight = this.height; var imgWidth, imgHeight; var scale = 0.8; if(realHeight>windowH*scale){ imgHeight = windowH*scale; imgWidth = imgHeight/realHeight*realWidth; if(imgWidth>windowW*scale) { imgWidth = windowW*scale; } } else if(realWidth>windowW*scale){ imgWidth = windowW*scale; imgHeight = imgWidth/realWidth*realHeight; } else { imgWidth = realWidth; imgHeight = realHeight; } $(bigimg).css("width",imgWidth); var w = (windowW-imgWidth)/2; var h = (windowH-imgHeight)/2; $(innerdiv).css({"top":h, "left":w}); $(outerdiv).fadeIn("fast"); }); $(outerdiv).click(function(){ $(this).fadeOut("fast"); }); }