1
0
mirror of https://github.com/bigchaindb/site.git synced 2024-12-01 13:37:14 +01:00
site/_src/_assets/javascripts/page-community.js

51 lines
1.7 KiB
JavaScript
Raw Normal View History

2016-02-10 01:04:57 +01:00
//=include ../../../node_modules/is-in-viewport/lib/isInViewport.js
//=include bigchain/testimonials.js
2016-02-10 01:04:57 +01:00
jQuery(function($) {
Testimonials.init();
2016-02-15 19:34:10 +01:00
var wrigley = $('#wrigley'),
wrigleyArm = wrigley.find('#arm'),
wrigleyHead = wrigley.find('#head'),
wrigleyEye = wrigley.find('#eye');
2016-02-10 01:04:57 +01:00
2016-02-15 19:34:10 +01:00
var wrigleyAnimationStart = function() {
// set utility classes
2016-02-15 19:34:10 +01:00
if (wrigley.is( ':in-viewport( -180 )' ) ) {
wrigley.addClass('is-ready');
// toggle paused class so the :hover interaction can fire animation again
2016-02-15 19:34:10 +01:00
wrigleyArm.on('animationend webkitAnimationEnd oAnimationEnd', function(e) {
wrigleyArm.addClass('paused');
wrigleyHead.addClass('paused');
2016-02-15 19:34:10 +01:00
wrigley.on('mouseover', function() {
wrigleyArm.removeClass('paused');
wrigleyHead.removeClass('paused');
});
// fire eye blinking once other animations have finished
2016-02-15 19:34:10 +01:00
wrigleyEye.addClass('is-ready');
2016-02-15 19:34:10 +01:00
wrigleyEye.on('animationend webkitAnimationEnd oAnimationEnd', function(e) {
wrigleyEye.removeClass('is-ready');
});
}
);
} else {
2016-02-15 19:34:10 +01:00
wrigley.removeClass('is-ready').removeClass('paused');
wrigleyArm.removeClass('paused');
wrigleyHead.removeClass('paused');
wrigleyEye.removeClass('is-ready').removeClass('paused');
}
2016-02-10 01:04:57 +01:00
}
// fire all the viewport things
2016-02-15 19:34:10 +01:00
wrigleyAnimationStart();
$(window).on('load resize scroll', wrigleyAnimationStart);
2016-02-10 01:04:57 +01:00
});