|
var tag = document.createElement('script'); |
|
tag.src = 'https://www.youtube.com/player_api'; |
|
var firstScriptTag = document.getElementsByTagName('script')[0]; |
|
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); |
|
var tv, |
|
playerDefaults = {autoplay: 0, autohide: 1, modestbranding: 0, rel: 0, showinfo: 0, controls: 0, disablekb: 1, enablejsapi: 0, iv_load_policy: 3}; |
|
var vid = {'videoId': '6z8Z9Mp2quo', 'suggestedQuality': 'hd1080', startSeconds: 6, endSeconds: 33}; |
|
|
|
|
|
|
|
function onYouTubePlayerAPIReady(){ |
|
tv = new YT.Player('tv', {events: {'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange}, playerVars: playerDefaults}); |
|
} |
|
|
|
function onPlayerReady(){ |
|
tv.loadVideoById(vid).mute(); |
|
} |
|
|
|
function onPlayerStateChange(e) { |
|
if (e.data === 1){ |
|
$('#tv').addClass('on'); |
|
} else if (e.data === 0){ |
|
tv.seekTo(vid.startSeconds); |
|
} |
|
} |
|
|
|
var hr = 26; |
|
|
|
$(document).ready(function(){ |
|
|
|
TweenLite.set('.eo', {transformPerspective: 1567, rotationX: 43, rotationY: 33}); |
|
|
|
$('.hovers') |
|
.on('mouseover', 'li:nth-child(1)', function(){ |
|
TweenLite.to('.eo', 1.5, {rotationX: -hr, rotationY: hr, ease: 'Power4.easeOut'}); |
|
}) |
|
.on('mouseover', 'li:nth-child(2)', function(){ |
|
TweenLite.to('.eo', 1.5, {rotationX: -hr, rotationY: -hr, ease: 'Power4.easeOut'}); |
|
}) |
|
.on('mouseover', 'li:nth-child(3)', function(){ |
|
TweenLite.to('.eo', 1.5, {rotationX: hr, rotationY: hr, ease: 'Power4.easeOut'}); |
|
}) |
|
.on('mouseover', 'li:nth-child(4)', function(){ |
|
TweenLite.to('.eo', 1.5, {rotationX: hr, rotationY: -hr, ease: 'Power4.easeOut'}); |
|
}) |
|
.on('mouseout', function(){ |
|
TweenLite.to('.eo', 3, {rotationX: 43, rotationY: 33, ease: 'Power4.easeOut'}); |
|
}) |
|
}); |