$(window).load(function() { $('.banner').flexslider({ animation: 'slide', pauseonaction: false, before: function(slider) { var target = slider.slides.eq(slider.animatingto); tweenmax.fromto(target.find('.text'), 2, { left: '95%' }, { left: '50%' }); tweenmax.fromto(target.find('.para'), 1.6, { left: '30%' }, { left: '0' }); }, slideshowspeed: 7000, animationspeed: 1000, animationloop: false }); $('.banner img').mousedown(function() { return false; }); $('.newsslide').flexslider({ animation: 'slide', controlnav: false, slideshowspeed: 5000 }); var kicks = $('.kwicks .kwick'); var curindex = 0; var arr = ["#ff6e00", '#228dcc', "#ce1c22", "#e89f13", "#579b20", "#f6588b", "#00407d", "#00632b", "#6b3a71"]; var tarnum = 0; kicks.bind('mouseenter', function() { var tarindex = kicks.index(this); if(curindex != tarindex) { tarnum = tarindex; tweenmax.to(kicks.eq(curindex), 0.5, { width: 66 }); tweenmax.to(kicks.eq(curindex).find('.icon'), 0.3, { backgroundcolor: 'transparent' }); tweenmax.to(kicks.eq(tarindex), 0.5, { width: 535 }); tweenmax.to(kicks.eq(tarindex).find('.icon'), 0.3, { backgroundcolor: arr[tarnum] }); curindex = tarindex; } }); function resizebanner() { if(document.documentelement.clientwidth > 1600) { $('.banner').removeclass('banner-s'); $('.banner .para').css('margin-left', 0); } else { $('.banner').addclass('banner-s'); $('.banner .para').css('margin-left', document.documentelement.clientwidth / 2 - 800); } } resizebanner(); $(window).resize(function() { resizebanner(); }); });