/* * @author: zty * @date: 2015-10-13 15:48:53 * @last modified time: 2016-09-10 16:47:16 */ $(function(){ $('#slider').nivoslider({ manualadvance:false, pausetime:5000, animspeed:500, startslide:0, pauseonhover:false }); $("header").headroom({ offset : 0, tolerance : 10, classes : { pinned : "bounceindown", unpinned : "bounceoutup" } }); $('.nivo-control,.nivo-directionnav a').text(''); $('#menu li').removeclass('now'); $('#menu li').eq(3).addclass('now'); $.each($('.p-li,.product-list li'), function(index, value) { $(value).css({'animation-delay':math.random() *0.5+"s"}); }); $.each($('.card-list li'), function(index, value) { $(this).css({ 'transition-delay': index/5 + 's' }); }); $.each($('.video-list li'), function(index,value){ $('.video-list li').eq(index).hover(function(){ $('.wf-img-list li').removeclass('active'); $('.wf-img-list li').eq(index).addclass('active'); }); }); }); (function($) { if(!$) { return; } //////////// // plugin // //////////// $.fn.headroom = function(option) { return this.each(function() { var $this = $(this), data = $this.data('headroom'), options = typeof option === 'object' && option; options = $.extend(true, {}, headroom.options, options); if (!data) { data = new headroom(this, options); data.init(); $this.data('headroom', data); } if (typeof option === 'string') { data[option](); if(option === 'destroy'){ $this.removedata('headroom'); } } }); }; ////////////// // data api // ////////////// $('[data-headroom]').each(function() { var $this = $(this); $this.headroom($this.data()); }); }(window.zepto || window.jquery)); function showtop(index){ return ($(index).offset().top - $(window).height() + 200); } function fade(which){ $(which).addclass('fadeinup animated'); } window.onload = function(){ $('.history-list li:odd .his-text-box,.history-list li:even .his-img').attr({ 'data-scroll-reveal': 'enter right and move 100px over .43s'}); $('.history-list li:even .his-text-box,.history-list li:odd .his-img').attr({ 'data-scroll-reveal': 'enter left and move 100px over .43s'}); $('.card-list li').addclass('show'); window.scrollreveal = new scrollreveal({ reset: true, move: '50px'}); $('header').addclass('animated bounceindown'); window.onscroll = function(){ var sc = $(document).scrolltop(); if( sc >= showtop('.p-img-box')){ fade('.p-li'); } if( sc > showtop('.about-img') && sc < showtop('.about-img')+800){ $('.about-img').addclass('fd'); } if(sc <= showtop('.about-img')-800 || sc >= showtop('.about-img')+1000){ $('.about-img').removeclass('fd'); } if( sc >= showtop('.news')){ $('.atree').stop().animate({height:'632px'},1200,function(){ $(this).find('.fadein').fadein(800,function(){ $('.tree').addclass('row'); $('.tree').removeclass('atree'); return false; }); }); } } }