Sha256: e41ca187096a290d6cc685d362d3ff9d44fac8d39115e2dfeda2b82984782685

Contents?: true

Size: 953 Bytes

Versions: 3

Compression:

Stored size: 953 Bytes

Contents

;(function(){
  // Add relative timestamps
  jQuery('.time-ago').timeago();

  // Ripped from 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');
        }
      });
    });
  });
})();

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kitchen_hooks-1.3.2 web/app/kitchen_hooks.js
kitchen_hooks-1.3.1 web/app/kitchen_hooks.js
kitchen_hooks-1.3.0 web/app/kitchen_hooks.js