Created
January 20, 2020 23:01
-
-
Save CodeMyUI/b7497b131e0709c80d292d7fa80ea857 to your computer and use it in GitHub Desktop.
Angled Youtube Embed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="vh-100 flex justify-center items-center vh-100"> | |
<div id="vidWrapper" class="vid isAngled"> | |
<div id="player" class="vid-wrap"></div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var player; | |
function onYouTubeIframeAPIReady() { | |
player = new YT.Player('player', { | |
height: '350', | |
width: '615', | |
videoId: '3-aM0DrLuuw?rel=0&controls=0&showinfo=0&modestbranding=1', | |
events: { | |
'onStateChange': function(event) { | |
if (event.data == YT.PlayerState.PLAYING) { | |
$('.vid').removeClass('isAngled'); | |
} else { | |
$('.vid').addClass('isAngled'); | |
} | |
} | |
} | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-youtube/2.5.0/Youtube.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.vid { | |
transition: .5s all; | |
border-radius: 1rem; | |
overflow: hidden; | |
&-wrap { | |
border-radius: 1rem; | |
overflow: hidden; | |
} | |
} | |
.isAngled { | |
transform: perspective(1000px) rotateY(25deg); | |
perspective: 10px; | |
transform-style: preserve-3d; | |
box-shadow: -20px 30px 85px rgba(210,130,190,.5); | |
transition: .5s all; | |
border-radius: 1rem; | |
overflow: hidden; | |
height: 350px; | |
&:hover { | |
transform: perspective(0px) rotateY(0deg); | |
box-shadow: 0 5px 20px rgba(210,130,190,.75); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://cdnjs.cloudflare.com/ajax/libs/tachyons/4.9.1/tachyons.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment