1
0
mirror of https://github.com/bigchaindb/site.git synced 2024-11-02 00:05:37 +01:00
site/_src/_assets/javascripts/page-getstarted.js

57 lines
1.7 KiB
JavaScript
Raw Normal View History

2017-06-15 19:16:45 +02:00
//=include bigchain/smoothscroll.js
//=include bigchain/newsletter.js
2017-06-15 19:16:45 +02:00
//=include is-in-viewport/lib/isInViewport.js
2016-02-10 01:04:57 +01:00
jQuery(function($) {
2017-06-15 19:16:45 +02:00
//
// init modules
//
Newsletter.init()
2017-06-15 19:16:45 +02:00
//
// Wrigley
//
2016-02-15 19:34:10 +01:00
var wrigley = $('#wrigley'),
wrigleyArm = wrigley.find('#arm'),
wrigleyHead = wrigley.find('#head'),
2017-06-15 19:16:45 +02:00
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 )' ) ) {
2017-06-15 19:16:45 +02:00
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) {
2017-06-15 19:16:45 +02:00
wrigleyArm.addClass('paused')
wrigleyHead.addClass('paused')
2016-02-15 19:34:10 +01:00
wrigley.on('mouseover', function() {
2017-06-15 19:16:45 +02:00
wrigleyArm.removeClass('paused')
wrigleyHead.removeClass('paused')
})
// fire eye blinking once other animations have finished
2017-06-15 19:16:45 +02:00
wrigleyEye.addClass('is-ready')
2016-02-15 19:34:10 +01:00
wrigleyEye.on('animationend webkitAnimationEnd oAnimationEnd', function(e) {
2017-06-15 19:16:45 +02:00
wrigleyEye.removeClass('is-ready')
})
}
2017-06-15 19:16:45 +02:00
)
} else {
2017-06-15 19:16:45 +02: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
2017-06-15 19:16:45 +02:00
wrigleyAnimationStart()
$(window).on('load resize scroll', wrigleyAnimationStart)
})