/** * created by george on 3/24/2015. */ var partnerindex = 0; $(function () { /*运动函数1*/ /*var dynamic=document.getelementbyid('demo1'); var dynamic2=document.getelementbyid('demo2'); var anews_li=dynamic.children; var anews_li_2=dynamic2.children; dynamic.innerhtml+=dynamic.innerhtml; dynamic2.innerhtml+=dynamic2.innerhtml; var h=dynamic.offsetheight/2; var h2=dynamic2.offsetheight/2; var length=anews_li.length/2; var length2=anews_li_2.length/2; var count=0; var count2=0; var timer2=null; dynamic.style.top=0; dynamic2.style.top=0;*/ /*function auto(){ if(count==length){ count=0; dynamic.style.top=0; }; if(count2==length2){ count2=0; dynamic2.style.top=0; }; count++; count2++; move(dynamic,{top:-count*anews_li[0].offsetheight},{time:700}); move(dynamic2,{top:-count2*anews_li_2[0].offsetheight},{time:700}); //alert(count) };*/ /* var dynamic2=document.getelementbyid('demo2'); var anews_li2=dynamic2.children; dynamic2.innerhtml+=dynamic2.innerhtml; var h2=dynamic2.offsetheight/2; var length2=anews_li2.length/2; var count2=0; var timer22=null; function auto(){ if(count2==length2){ count2=0; dynamic2.style.top=0; }; count++; move(dynamic2,{top:-count*anews_li2[0].offsetheight},{time:700}); //alert(count) }; */ /*运动函数2*/ /*function getstyle(obj, name) { return (obj.currentstyle)?(obj.currentstyle[name]):(getcomputedstyle(obj, false)[name]); } function move(obj, json, options) { options=options||{}; options.type=options.type||'buffer'; options.time=options.time||700; var count=parseint(options.time/30); var n=0; var start={}; var dis={}; for(var name in json) { if(name=='opacity') { start[name]=math.round(parsefloat(getstyle(obj, name))*100); } else { start[name]=parseint(getstyle(obj, name)); } dis[name]=json[name]-start[name]; } clearinterval(obj.timer); obj.timer=setinterval(function (){ n++; for(var name in json) { switch(options.type) { case 'linear': var cur=start[name]+dis[name]*n/count; break; case 'buffer': var a=1-n/count; var cur=start[name]+dis[name]*(1-a*a*a); break; case 'ease-in': var a=n/count; var cur=start[name]+dis[name]*(a*a*a); break; } if(name=='opacity') { obj.style.filter='alpha(opacity:'+cur+')'; obj.style.opacity=cur/100; } else { obj.style[name]=cur+'px'; } } if(n==count) { clearinterval(obj.timer); options.end && options.end(); } }, 30); };*/ /*timer2=setinterval(auto,2000);*/ //timer22=setinterval(auto,2000); $(".carousel").owlcarousel({"items": 1, autoplay: true}); var carouselcase = $(".carousel-case").owlcarousel({"items": 1, "pagination": false, 'addclassactive': true}); var carousellive = $(".carousel-live").owlcarousel({"items": 4}); /* $(".carousel-game").owlcarousel({"items": 4}); $(".carousel-business").owlcarousel({"items": 4}); $(".carousel-travel").owlcarousel({"items": 4});*/ $(".carousel-percent").owlcarousel({"items": 4, autoplay: true}); $(".carousel-percent .owl-pagination").hide(); var carouselmap = $(".carousel-map").owlcarousel({"items": 1, "pagination": false}); //首页地图 $(".contact .nav li").click(function(){ $(this).addclass("current").siblings().removeclass("current"); var index=$(this).index(); $(".carousel-mapa div").eq(index).show().siblings().hide(); }); $(".carousel-left-btn").click(function () { var activecarousel = $('.carousel-case .owl-item.active').find('.owl-carousel'); carousellive.trigger('owl.prev'); }); $(".carousel-right-btn").click(function () { var activecarousel = $('.owl-item.active').find('.owl-carousel'); activecarousel.trigger('owl.next'); }); $('[data-ride="animated"]').appear(); if (!$('html').hasclass('ie no-ie10')) { $('[data-ride="animated"]').addclass('appear'); $('[data-ride="animated"]').on('appear', function () { var $el = $(this), $ani = ($el.data('animation') || 'fadein'), $delay; if (!$el.hasclass('animated')) { $delay = $el.data('delay') || 0; settimeout(function () { $el.removeclass('appear').addclass($ani + " animated"); }, $delay); } }); }; function chart() { $('.chart').easypiechart({ barcolor: '#69c', trackcolor: '#fff', scalecolor: false, linewidth: 6, trackwidth: 6, linecap: 'butt', easing: 'easeoutbounce', onstep: function(from, to, percent) { $(this.el).find('.percent').text(math.round(percent)); } }); } function scrollchar(){ var carouseltop = $('.carousel-percent').offset().top; var scroll = $(window).scrolltop(); var windowheight = $(window).height(); if(scroll+windowheight >= carouseltop) { settimeout(function(){ chart(); },500); } } $(window).bind('scroll',scrollchar); $('.solution-list li').hover(function () { var wrapper = $(this).find('div'); wrapper.stop().transition({ rotate3d: '0,1,0,90deg' }, function () { // $(this).find('img').toggle(); wrapper.stop().transition({ rotate3d: '0,1,0,0deg' }); }); }, function () { var wrapper = $(this).find('div'); wrapper.transition({ rotate3d: '0,1,0,90deg' }, function () { $(this).find('img').toggle(); wrapper.transition({ rotate3d: '0,1,0,0deg' }); }); }); setinterval(function () { var val = parseint(math.random()*23) ; $('.partner-list li').eq(val).transition({ rotate3d: '0,1,0,90deg', }, function () { $(this).find('.partner-wrap').toggle(); $(this).transition({ rotate3d: '0,1,0,0deg', }); }); }, 2000); /* $('.contact .nav li.a').click(function (e) { alert("dsd"); $(this).siblings('li').removeclass('current'); $(this).addclass('current'); carouselmap.trigger('owl.goto', $(this).index()); });*/ $('.our-server a').hover(function () { $(this).css('z-index','23'); $(this).find("img").stop().transition({ scale: 1.1//缩放的 },'200', function(){ $(this).siblings('.server1-detail').stop().show('400'); }); }, function () { $(this).css('z-index','22'); $(this).stop().find("img").transition({ scale: 1 },'200', function(){ $(this).siblings('.server1-detail').stop().hide('200'); }); }); /*点击导航到相对应的位置*/ $('.nav-list li').click(function(){ var name = $(this).attr('name'); var top = $("." + name).offset().top; //console.log(top); var speed = 1000; $("html,body").stop().animate({scrolltop : top -94}, speed); $(this).addclass('currli').siblings('li').removeclass('currli'); }); $('.footer .link_us').click(function(){ var name = $(this).attr('name'); var top = $("." + name).offset().top; //console.log(top); var speed = 1000; $("html,body").stop().animate({scrolltop : top -94}, speed); $(this).addclass('currli').siblings('li').removeclass('currli'); }); /* 合作伙伴hover事件 */ $('.partner-list li').hover(function() { var _this = $(this).children('.partner-wrap'); toggleshow (_this,0,200) ; }, function() { var _this = $(this).children('.partner-wrap'); toggleshow (_this,100,200); }); function toggleshow (_this, num, speed){ var arr; for(var i=0 ; i<_this.length ; i++){ if($(_this[i]).css('display') == 'block'){ arr = $(_this[i]); arr.children('.partner-desc').stop().animate({'top': num+'%'},speed); } } } /*chart hover事件*/ $('.chart').hover(function(){ $(this).children('.icon').stop().transition({ scale : 1, opacity: 1 }); },function(){ $(this).children('.icon').stop().transition({ scale : 0, opacity : 0 }); }) /*人才招聘切换*/ var key = 0; setinterval(function () { if (key >= 6) { key = 0; } $('.recruitinfo .left').eq(key).transition({ rotate3d: '0,1,0,90deg' }, function () { $(this).find('.toggle').toggle(); $(this).transition({ rotate3d: '0,1,0,0deg' }, function () { key++; }); }); }, 3000); /* 首页数字翻页 */ $(window).bind('scroll',scrolltimer) function scrolltimer(){ var carouseltop = $('.count-list').offset().top; var scroll = $(window).scrolltop(); var windowheight = $(window).height(); if(scroll+windowheight >= carouseltop ) { settimeout(function(){ var timer = setinterval(function(){ autoplay(num1,timer,'.num-1'); } , 10); var timer2 = setinterval(function(){ autoplay(num2,timer2,'.num-2'); } , 10); var timer3 = setinterval(function(){ autoplay(num3,timer3,'.num-3'); } , 100); var timer4 = setinterval(function(){ autoplay(num4,timer4,'.num-4'); } , 50); },800); // console.log(2); }; } var num1 = parseint($('.num-1').text()); var num2 = parseint($('.num-2').text()); var num3 = parseint($('.num-3').text()); var num4 = parseint($('.num-4').text()); var num1change = 0; var num2change = 0; var num3change = 0; var num4change = 0; function autoplay (num,setname,obj) { if(obj == '.num-1') { num1change++; if(num1change >= num){ num1change = num ; clearinterval(setname); } $(obj).text(num1change); } if(obj == '.num-2') { num2change++; if(num2change >= num){ num2change = num ; clearinterval(setname); } $(obj).text(num2change); } if(obj == '.num-3') { num3change++; if(num3change >= num){ num3change = num ; clearinterval(setname); } $(obj).text(num3change); } if(obj == '.num-4') { num4change++; if(num4change >= num){ num4change = num ; clearinterval(setname); } $(obj).text(num4change); } } /* 案例展示 */ $('.cl-a').hover(function(){ $(this).children('.c-screen').fadein('400'); },function(){ $(this).children('.c-screen').hide(); }); /* 案例展示--tab切换 */ $('.case .nav li').click(function () { $(this).siblings('li').removeclass('current'); $(this).addclass('current'); var index=$(this).index(); var odiv = $(".carousel-list").find('.case-div'); odiv.hide(); $(".carousel-list .case-div").eq(index).show(); }); //首页的幻灯片 $('.bxslider').bxslider({ "controls":false, auto:true }); //案例展示 $('.carousel-game').bxslider({ controls:true, slidewidth: 224, minslides: 4, maxslides: 4, slidemargin: 10, pager:true, infiniteloop: false }); //页面跳转 /** * 首页导航的切换 */ loadyemian(); function loadyemian(){ var srcstr= window.location; srcstr =srcstr.tostring(); var num= srcstr.charat(srcstr.length-1); var name =""; if(num==1){ name="indexba"; }else if(num==2){ name="server"; }else if(num==3){ name="solution"; }else if(num==4){ name="case"; }else if(num==5){ name="math"; }else if(num==6){ name="industry"; }else if(num==7){ name="contact"; } if(name.length>0){ var top = $("." + name).offset().top; var speed = 1000; $("html,body").stop().animate({scrolltop : top -94}, speed); $("#header .nav-list li[name="+name+"]").addclass('currli').siblings('li').removeclass('currli'); } }; });