Team:SUSTC-Shenzhen/Human Practice/Team Communications/js/main.js
From 2014.igem.org
(Created page with "jQuery(document).ready(function($){ var $timeline_block = $('.cd-timeline-block'); //hide timeline blocks which are outside the viewport $timeline_block.each(function(){ if...") |
|||
Line 1: | Line 1: | ||
+ | /* http://codyhouse.co/gem/vertical-timeline/ */ | ||
jQuery(document).ready(function($){ | jQuery(document).ready(function($){ | ||
var $timeline_block = $('.cd-timeline-block'); | var $timeline_block = $('.cd-timeline-block'); |
Latest revision as of 18:38, 17 October 2014
/* http://codyhouse.co/gem/vertical-timeline/ */ jQuery(document).ready(function($){ var $timeline_block = $('.cd-timeline-block');
//hide timeline blocks which are outside the viewport $timeline_block.each(function(){ if($(this).offset().top > $(window).scrollTop()+$(window).height()*0.75) { $(this).find('.cd-timeline-img, .cd-timeline-content').addClass('is-hidden'); } });
//on scolling, show/animate timeline blocks when enter the viewport $(window).on('scroll', function(){ $timeline_block.each(function(){ if( $(this).offset().top <= $(window).scrollTop()+$(window).height()*0.75 && $(this).find('.cd-timeline-img').hasClass('is-hidden') ) { $(this).find('.cd-timeline-img, .cd-timeline-content').removeClass('is-hidden').addClass('bounce-in'); } }); }); });