$(function (){ /* start 澶勭悊 class 娓呴櫎鍙宠竟璺 绫诲悕 */ $.each([".project-performance ul li",".boutique-box ul li",".certificate-box ul li",".honour-box ul li"],function (index,sClass){ if($(sClass)[0]){ for(var i=1; i<=$(sClass).size();i++){ if(i%3==0){ $(sClass).eq(i-1).addClass("n"); } } } }); /* end 澶勭悊 class 娓呴櫎鍙宠竟璺 绫诲悕 */ /* 棣栭〉鏄庢槦鍗曚綅 */ $(".open-banner").on("click",function (){ $(".open-banner").hide(); $(".atipic").slideDown(); }); $(".aticlose").on("click",function (){ $(".open-banner").show(); return false; }); var statMove = function (){ if(!$(".stat-inner")[0]) return ; var stat = $(".stat-inner"); var pssListUl = $('.stat-list-box',stat); var pssListLi = $('.stat-list-box .stat-list-data',stat); var prev = $('.stat-prev'); var next = $('.stat-next'); var sWidth = pssListLi.outerWidth(true); var iNow=0; if(pssListLi.size() <= 1){ $(".stat-prev,.stat-next").hide(); } pssListUl.width(pssListLi.size() * (sWidth)); var move = function(index) { pssListUl.stop().animate({ left: -index * (sWidth) }, 450); }; prev.on("click",function (){ if(pssListLi.size() <= 1){ iNow--; }else if (iNow <= 0) { iNow = pssListLi.size() -1; } else { iNow--; } move(iNow); }); next.on("click",function (){ if (iNow == pssListLi.size() - 1) { iNow = 0; } else if(pssListLi.size() <= 1){ iNow = 0; }else{ iNow++; } move(iNow); }); var timer = null; var start = function (){ timer = setInterval(function (){ $('.stat-next').trigger("click"); },3000); }; start(); $(this).on("mouseover",function (){ clearInterval(timer); }).on("mouseout",function (){ start(); }); }; statMove(); /* 棣栭〉鏄庢槦鍗曚綅 */ var childrenNav = function (){ var b = $(".cstablist-item-bar").width(); if ($(".cstablist > ul > li a").hasClass('csCur')) { var a = $(".cstablist a.csCur").width(), c = $(".cstablist a.csCur").position().left; var d = 0; var x = c + d; $('.cstablist-item-bar').css("left", x); $('.cstablist-item-bar').stop(true, false).animate({ width: a + "px" }).show(); } $(".cstablist > ul > li").hover(function (e) { var a = $('a',this).width(), c = $('a',this).position().left; var d = 0; var x = c + d; $('.cstablist-item-bar').stop(true, false).animate({"left": x,width: a + "px"}, 300).show(); }, function () { if ($('.cstablist > ul > li a').hasClass('csCur')) { var a = $("a.csCur").width(); $('.cstablist-item-bar').stop(true, false).animate({"left": x,width: a + "px"}, 300); } else { $('.cstablist-item-bar').hide(); } }); }; childrenNav(); if($(".projectcont")[0]){ var projectcont_run = function (){ var timer_one = null; timer_one = setInterval(function (){ var x_one_val = parseInt($("#x-one").html()); if(x_one_val >= 25){ clearInterval(timer_one); }else{ $("#x-one").html((x_one_val+1)+'%'); } },50); var timer_two = null; timer_two = setInterval(function (){ var x_one_val = parseInt($("#x-two").html()); if(x_one_val >= 55){ clearInterval(timer_two); }else{ $("#x-two").html((x_one_val+1)+'%'); } },30); var timer_three = null; timer_three = setInterval(function (){ var x_one_val = parseInt($("#x-three").html()); if(x_one_val >= 10){ clearInterval(timer_three); }else{ $("#x-three").html((x_one_val+1)+'%'); } },70); var timer_four = null; timer_four = setInterval(function (){ var x_one_val = parseInt($("#x-four").html()); if(x_one_val >= 10){ clearInterval(timer_four); }else{ $("#x-four").html((x_one_val+1)+'%'); } },70); }; var projectcontFlag = false; $(window).scroll(function () { if ($(this).scrollTop() > ($(".projectcont").offset().top - 750) && projectcontFlag == false) { projectcontFlag = true; projectcont_run(); } }); if ($(window).scrollTop() > ($(".projectcont").offset().top - 750)) { // 25 55 10 10 projectcont_run(); } } $(".notice-item-data").on("click",function (){ $(".notice-body .active .notice-item-box").stop().slideUp(); $(".notice-item-data").removeClass("active"); $(".notice-item-box",this).stop().slideDown(); $(this).addClass("active"); }); $(document).on("click",".honour-box li a",function (){ var that = $(this); if(!$(".honour-layer")[0]){ var obj = $('
',{ "class" : "honour-layer" }); obj.css({ "position" : "fixed","display":"none","z-index":10000,'opacity':"0.6","top" : "0","left":"0","width" : "100%", "height" : "100%","background" : "#000" }); $("body").append(obj); var oDiv = $('
',{ "class" : "honour-odiv-box" }); var options = { "position" : "fixed", "display":"none", "z-index":10100, "top" : (($(window).height() - 750) / 2), "left":(($(window).width() - 1055) / 2), "width" : "1055px", "height" : "750px", "background":"#fff" }; oDiv.css(options); $("body").append(oDiv); $(".honour-odiv-box").append(''); $(".honour-odiv-box").append(''); } $(".honour-odiv-box img").attr("src",that.find("img").attr("src")); $(".honour-odiv-box").fadeIn(); $(".honour-layer").fadeIn(); return false; }); $(document).on("click",".honour-odiv-close",function (){ $(".honour-odiv-box").fadeOut(); $(".honour-layer").fadeOut(); return false; }); $(document).on("click",".certificate-box li a",function (){ var that = $(this); var index = $(".certificate-box li a").index($(this)); if(!$(".certificate-layer")[0]){ var obj = $('
',{ "class" : "certificate-layer" }); obj.css({ "position" : "fixed","display":"none","z-index":10000,'opacity':"0.7","top" : "0","left":"0","width" : "100%", "height" : "100%","background" : "#000" }); $("body").append(obj); var oDiv = $('
',{ "class" : "certificate-odiv-box" }); var options = { "position" : "fixed", "display":"none", "z-index":10100, "top" : (($(window).height() - 750) / 2), "left":(($(window).width() - 1055) / 2), "width" : "1100px", "height" : "656px", "background":"#fff" }; oDiv.css(options); $("body").append(oDiv); $("body").append(''); $("body").append(''); $("body").append(''); $(".certificate-odiv-box").append(''); } var img = new Image(); img.src = that.find("img").attr("src"); img.onload = function (){ $(".certificate-odiv-box").css({ "top" : (($(window).height() - img.height) / 2), "left":(($(window).width() - img.width) / 2), "width" : img.width+"px", "height" : img.height+"px" }); $(".o-certificate-image").css({ "width" : img.width+"px", "height" : img.height+"px" }); $(".certificate-odiv-box img").attr("src",that.find("img").attr("src")); $(".certificate-odiv-box img").attr("data-index",index); $(".certificate-odiv-box").fadeIn(); $(".certificate-layer").fadeIn(); $(".o-certificate-close,.o-certificate-arrow-l,.o-certificate-arrow-r").show(); }; return false; }); $(document).on("click",".o-certificate-arrow-l",function (){ var index = $(".certificate-odiv-box img").attr("data-index"); if(index <= 0){ index = $(".certificate-box li img").size() - 1; }else{ index--; } var img = $(".certificate-box li img").eq(index); if(!img[0]){ return false; } var image = new Image(); image.src = img.attr("src"); image.onload = function (){ $(".certificate-odiv-box").css({ "top" : (($(window).height() - image.height) / 2), "left":(($(window).width() - image.width) / 2), "width" : image.width+"px", "height" : image.height+"px" }); $(".o-certificate-image").css({ "width" : image.width+"px", "height" : image.height+"px" }); $(".certificate-odiv-box img").attr("src",$(".certificate-box li img").eq(index).attr("src")); $(".certificate-odiv-box img").attr("data-index",index); }; return false; }); $(document).on("click",".o-certificate-arrow-r",function (){ var index = $(".certificate-odiv-box img").attr("data-index"); if(index == $(".certificate-box li img").size() - 1){ index = 0; }else{ index++; } var img = $(".certificate-box li img").eq(index); if(!img[0]){ return false; } var image = new Image(); image.src = img.attr("src"); image.onload = function (){ $(".certificate-odiv-box").css({ "top" : (($(window).height() - image.height) / 2), "left":(($(window).width() - image.width) / 2), "width" : image.width+"px", "height" : image.height+"px" }); $(".o-certificate-image").css({ "width" : image.width+"px", "height" : image.height+"px" }); $(".certificate-odiv-box img").attr("src",$(".certificate-box li img").eq(index).attr("src")); $(".certificate-odiv-box img").attr("data-index",index); }; return false; }); $(document).on("click",".o-certificate-close",function (){ $(".certificate-odiv-box").fadeOut(); $(".certificate-layer").fadeOut(); $(".o-certificate-close,.o-certificate-arrow-l,.o-certificate-arrow-r").hide(); return false; }); $(".aticlose").on("click",function (){ $(".atipic").slideUp(); return false; }); if(!$(".header .nav-layer")[0]){ $(".header").append(""); } var arrPosition = ['0','10px','10px','0','20px','-575px','-250px','-216px']; $(".mainNav > ul > li").each(function (index){ if($(".subNav",this)[0]){ var navWidth = 0; $(".subNav li",this).each(function (){ navWidth += $(this).actual("outerWidth") + 40; }); $(".subNav",this).css("width",navWidth); if(arrPosition[index] != 0){ $(".subNav",this).css("left",arrPosition[index]); } } }); $(".mainNav > ul > li").on("mouseover",function (){ $(".mainNav .subNav").hide(); $(".header .nav-layer").hide(); $(".mainNav > ul > li").removeClass("layui-this"); if($(".subNav",this)[0]){ $(".header .nav-layer").stop(false,false,false).slideDown(300); $(".subNav",this).stop(false,false,false).slideDown(300); $(".hsearsub").hide(); } }).on("mouseout",function (){ $(".mainNav .subNav").stop(false,false,false).slideUp(300); $(".header .nav-layer").stop(false,false,false).slideUp(300); }); function nav() { var b = $(".nav-item-bar").width(); if ($(".mainNav > ul > li").hasClass('hover')) { var a = $("li.hover").width(), c = $("li.hover").position().left; var d = (a - b) / 2; var x = c + d; $('.nav-item-bar').css("left", x); } $(".mainNav > ul > li").hover(function (e) { var a = $(this).width(), c = $(this).position().left; var d = (a - b) / 2; var x = c + d; $('.nav-item-bar').stop(true, false).animate({"left": x}, 300).show(); }, function () { if ($('.mainNav > ul > li').hasClass('hover')) { $('.nav-item-bar').stop(true, false).animate({"left": x}, 300); } else { $('.nav-item-bar').hide(); } }); } nav(); $(window).resize(function () { nav(); }); var searchTimer = null; $(".hsearch").on("mouseover",function (){ clearInterval(searchTimer); $(".hsearsub").show(); }).on("mouseout",function (){ searchTimer = setInterval(function (){ $(".hsearsub").hide(); },300); }); $(".fncRight a.wb").on("mouseover",function (){ $(".fncRight .wxbox").show(); }).on("mouseout",function (){ $(".fncRight .wxbox").hide(); }); $(".top-banner").banner(3000); $("#banner").banner(5000); $(".engineercontent").listImages(); $(".enterprise-rr").enterprise(3000); $(".prodetailslider").showImagesLIst(); }); ;(function ($) { $.fn.showImagesLIst = function (){ var _self = $(this); var prosliderpicLi = $('.prosliderpic ul li',_self); var prosliderlistUl = $('.prosliderlist ul',_self); var prosliderlistLi = $('.prosliderlist ul li',_self); var psPrev = $('.proslidersmallpic .prosliPrev',_self); var psNext = $('.proslidersmallpic .prosliNext',_self); var sWidth = prosliderlistLi.width(); var oClick = 0, iNow = 0, now = 0; prosliderlistUl.width(prosliderlistLi.size() * sWidth); $('.prosliderpic ul li:eq(0)',_self).show(); $("li:not(:first-child)", $('.prosliderpic ul',_self)).hide(); var move = function(index) { prosliderlistUl.stop().animate({ left: -index * sWidth }, 700); }; $(".prosliderlist ul li:first",_self).addClass("active"); $(".pros-pageing").html('1 / '+prosliderpicLi.size()); $(".pros-title").html($(".prosliderpic img:first").attr("alt")); var fade = function (index) { $(".pros-pageing").html(''+(index+1)+' / '+prosliderpicLi.size()); $(".pros-title").html($(".prosliderpic img").eq(index).attr("alt")); $(".prosliderlist ul li").removeClass("active").eq(index).addClass("active"); prosliderpicLi.filter(":visible").fadeOut(500).parent().children().eq(index).fadeIn(600); }; $(".prosli-prev").on("click",function (){ if(prosliderpicLi.size() <= 1){ now--; }else if (now <= 0) { return false; } else { now--; fade(now); } psPrev.trigger("click"); }); $(".prosli-next").on("click",function (){ if (now == prosliderpicLi.size() - 1) { return false; } else if(prosliderpicLi.size() <= 1){ return false; }else{ now++; } fade(now); psNext.trigger("click"); }); prosliderlistLi.click(function (){ var index = $(this).index(); if (index === oClick) return false; now = index; fade(index); oClick = index; }); psPrev.click(function (){ if(prosliderlistLi.size() <= 6){ iNow--; }else if (iNow <= 0) { return false; } else { iNow--; move(iNow); } }); psNext.click(function (){ if (iNow == prosliderlistLi.size() - 6) { return false; } else if(prosliderlistLi.size() <= 6){ return false; }else{ iNow++; } move(iNow); }); }; $.fn.enterprise = function (sp){ var sUl = $('ul', this); var sLi = $('ul li', this); var sImg = $('ul li img', this); var iNow = 0, timer = null, speed = sp; var image = [], is_load = [],iWidth = 1920;; var arrHeight = []; var aFont = []; var _self = $(this); $("li:not(:first-child)", sUl).hide(); $('li img', sUl).each(function (index) { image[index] = $(this).data('src'); is_load[index] = false; aFont[index] = $(this).attr('alt'); }); var oImage = new Image(); var load = function (index, flag) { $('.loader-bg').show(); sLi.eq(index).find('img').attr('src', image[index]).one('load', function () { $('.loader-bg').hide(); is_load[index] = true; oImage.src = $(this).attr('src'); var iWidth = oImage.width; var iHeight = oImage.height; var veiwWidth = $(window).width(); //$(this).css({left: -(iWidth - veiwWidth) / 2, height: iHeight}); arrHeight.push(iHeight); if (!flag) { sLi.eq(index).fadeIn(800); } else { fade(index); } }).each(function () { if (this.complete) { $(this).load(); } }); }; load(0, false); $(".enterprise-list-img a:first",_self).addClass("active"); var fade = function (index) { if(sLi.size() <= 1) return ; $(".enterprise-list-img a",_self).removeClass("active").eq(index).addClass("active"); $("li", sUl).filter(":visible").fadeOut(500).parent().children().eq(index).fadeIn(600); }; var checkLoad = function (index) { iNow = index; if (is_load[index]) { fade(index); } else { load(index, true); } }; var move = function () { if (iNow == sLi.size() - 1) { iNow = 0; } else { iNow++; } checkLoad(iNow); }; $('.arrow-img-l',_self).click(function (){ if(iNow <= 0){ iNow = sLi.size() -1; }else{ iNow--; } checkLoad(iNow); }); $('.arrow-img-r',_self).click(function (){ if(iNow == sLi.size() -1){ iNow = 0; }else{ iNow++; } checkLoad(iNow); }); $(".enterprise-list-img a",_self).each(function (index){ $(this).on("click",function (){ if($(sLi).eq(index).is(":visible")){ return ; } checkLoad(index); }); }); timer = setInterval(move, speed); $(this).on({ mouseover: function () { clearInterval(timer); }, mouseout: function () { timer = setInterval(move, speed); } }); }; $.fn.banner = function (sp){ $(this).each(function (){ var sUl = $('ul', this); var sLi = $('ul li', this); var sImg = $('ul li img', this); var iNow = 0, timer = null, speed = sp; var image = [], is_load = [],iWidth = 1920;; var arrHeight = []; var aFont = []; var _self = $(this); var reSize = function () { var veiwWidth = $(window).width(); if (veiwWidth > 1000) { for (var i = 0; i < sImg.size(); i++) { sImg.eq(i).css({left: -(iWidth - veiwWidth) / 2}); } } }; reSize(); $(window).resize(reSize); $("li:not(:first-child)", sUl).hide(); var string = $('
', {'class': 'loader-bg'}).css({ display: 'none', width: 48, height: 48, position: 'absolute', top: '50%', left: '48%', zIndex: 9999, background: 'url(l/loading.gif) no-repeat' }); //$(this).prepend(string); //$(".loader-bg").css('left', ($(this).outerWidth() - $(".loader-bg").outerWidth(true)) / 2); $('li img', sUl).each(function (index) { image[index] = $(this).data('src'); is_load[index] = false; aFont[index] = $(this).attr('alt'); }); var oImage = new Image(); var load = function (index, flag) { $('.loader-bg').show(); sLi.eq(index).find('img').attr('src', image[index]).one('load', function () { $('.loader-bg').hide(); is_load[index] = true; oImage.src = $(this).attr('src'); var iWidth = oImage.width; var iHeight = oImage.height; var veiwWidth = $(window).width(); $(this).css({left: -(iWidth - veiwWidth) / 2}); arrHeight.push(iHeight); if (!flag) { sLi.eq(index).fadeIn(800); } else { fade(index); } }).each(function () { if (this.complete) { $(this).load(); } }); }; load(0, false); $(".banner-pageing a:first",_self).addClass("active"); var fade = function (index) { if(sLi.size() <= 1) return ; $(".banner-pageing a",_self).removeClass("active").eq(index).addClass("active"); $("li", sUl).filter(":visible").fadeOut(500).parent().children().eq(index).fadeIn(600); }; var checkLoad = function (index) { iNow = index; if (is_load[index]) { fade(index); } else { load(index, true); } }; var move = function () { if (iNow == sLi.size() - 1) { iNow = 0; } else { iNow++; } checkLoad(iNow); }; $('.arrow-l',_self).click(function (){ if(iNow <= 0){ iNow = sLi.size() -1; }else{ iNow--; } checkLoad(iNow); }); $('.arrow-r',_self).click(function (){ if(iNow == sLi.size() -1){ iNow = 0; }else{ iNow++; } checkLoad(iNow); }); $(".banner-pageing a",_self).each(function (index){ $(this).on("click",function (){ if($(sLi).eq(index).is(":visible")){ return ; } checkLoad(index); }); }); timer = setInterval(move, speed); $(this).on({ mouseover: function () { $('.slider-btn',_self).show(); clearInterval(timer); }, mouseout: function () { $('.slider-btn',_self).hide(); timer = setInterval(move, speed); } }); }); }; $.fn.listImages = function(){ if($(this).size() <= 0) return ; var _self = $(this); var pssListUl = $('ul',_self); var pssListLi = $('ul li',_self); var prev = $('.egprev',_self); var next = $('.egnext',_self); var sWidth = pssListLi.outerWidth(true); var iNow=0; pssListUl.width(pssListLi.size() * (sWidth)); var move = function(index) { pssListUl.stop().animate({ left: -index * (sWidth) }, 450); }; prev.on("click",function (){ if(pssListLi.size() <= 3){ iNow--; }else if (iNow <= 0) { iNow = pssListLi.size() -3; } else { iNow--; } move(iNow); }); next.on("click",function (){ if (iNow == pssListLi.size() - 3) { iNow = 0; } else if(pssListLi.size() <= 3){ iNow = 0; }else{ iNow++; } move(iNow); }); var timer = null; var start = function (){ timer = setInterval(function (){ $('.egnext').trigger("click"); },3000); }; start(); $(this).on("mouseover",function (){ clearInterval(timer); }).on("mouseout",function (){ start(); }); }; })(jQuery); ;( function ( $ ){ $.fn.addBack = $.fn.addBack || $.fn.andSelf; $.fn.extend({ actual : function ( method, options ){ // check if the jQuery method exist if( !this[ method ]){ throw '$.actual => The jQuery method "' + method + '" you called does not exist'; } var defaults = { absolute : false, clone : false, includeMargin : false }; var configs = $.extend( defaults, options ); var $target = this.eq( 0 ); var fix, restore; if( configs.clone === true ){ fix = function (){ var style = 'position: absolute !important; top: -1000 !important; '; // this is useful with css3pie $target = $target. clone(). attr( 'style', style ). appendTo( 'body' ); }; restore = function (){ // remove DOM element after getting the width $target.remove(); }; }else{ var tmp = []; var style = ''; var $hidden; fix = function (){ // get all hidden parents $hidden = $target.parents().addBack().filter( ':hidden' ); style += 'visibility: hidden !important; display: block !important; '; if( configs.absolute === true ) style += 'position: absolute !important; '; // save the origin style props // set the hidden el css to be got the actual value later $hidden.each( function (){ var $this = $( this ); // Save original style. If no style was set, attr() returns undefined tmp.push( $this.attr( 'style' )); $this.attr( 'style', style ); }); }; restore = function (){ // restore origin style values $hidden.each( function ( i ){ var $this = $( this ); var _tmp = tmp[ i ]; if( _tmp === undefined ){ $this.removeAttr( 'style' ); }else{ $this.attr( 'style', _tmp ); } }); }; } fix(); // get the actual value with user specific methed // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc // configs.includeMargin only works for 'outerWidth' and 'outerHeight' var actual = /(outer)/.test( method ) ? $target[ method ]( configs.includeMargin ) : $target[ method ](); restore(); // IMPORTANT, this plugin only return the value of the first element return actual; } }); })( jQuery );