JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
HTML Settings
Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
<!-- IOS Bug dont Use this code-->
<div class="wrapper">
<!-- begin Video Youtube
=========================================================================== -->
<div class="video-youtube video-youtube_overlay">
<div id="video-youtube__content" class="video-youtube__content video-youtube__content_hide-origin-play-btn"></div>
<button type="button" class="video-youtube__new-play-btn"></button>
</div>
<!-- end Video Youtube
=========================================================================== -->
</div>
/* IOS Bug dont Use this code */
.hidden {
display: none !important;
}
.wrapper {
max-width: 560px;
width: 100%;
margin-left: auto;
margin-right: auto;
margin-top: 100px;
}
/* -------------------------------------------------------------------------
begin Video Youtube
* ------------------------------------------------------------------------- */
.video-youtube {
position: relative;
padding-bottom: 56.25%;
padding-top: 25px;
height: 0;
&.video-youtube_overlay {
&:before {
content: '';
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: transparent;
width: 100%;
height: 100%;
display: block;
z-index: 5;
}
}
.video-youtube__content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
&.video-youtube__content_hide-origin-play-btn {
width: 10000%;
height: 10000%;
transform: scale(.01);
transform-origin: top left;
&::selection {
background-color: transparent;
}
}
}
.video-youtube__new-play-btn {
max-width: 153px;
max-height: 153px;
width: 100%;
height: 100%;
border: none;
background-color: transparent;
background-image: url(https://erweb.ru/wp-content/uploads/2017/09/youtube-play.png);
background-size: contain;
background-repeat: no-repeat;
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 10;
cursor: pointer;
}
}
/* -------------------------------------------------------------------------
end Video Youtube
* ------------------------------------------------------------------------- */
/* IOS Bug dont Use this code */
'use strict';
/* -------------------------------------------------------------------------
begin Video Youtube
* ------------------------------------------------------------------------- */
function onYouTubePlayerAPIReady() {
var playerYoutube;
playerYoutube = new YT.Player("video-youtube__content", {
videoId: "cxXUEDbOxgo",
playerVars: {
// 'controls': 0,
// 'showinfo': 0,
// 'disablekb': 1
},
events: {
onReady: onYouTubePlayerReady
}
});
}
function onYouTubePlayerReady(event) {
// https://developers.google.com/youtube/iframe_api_reference#Events
var targetYoutubeVideo = event.target;
var videoDomElem = document.getElementById(
event.target.getIframe().getAttribute("id")
);
var newPlayBtn = videoDomElem.nextElementSibling;
newPlayBtn.addEventListener("click", function(event) {
targetYoutubeVideo.playVideo();
this.classList.add('hidden');
videoDomElem.classList.remove('video-youtube__content_hide-origin-play-btn');
videoDomElem.parentNode.classList.remove('video-youtube_overlay');
});
}
var tag = document.createElement("script");
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName("script")[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
/* -------------------------------------------------------------------------
end Video Youtube
* ------------------------------------------------------------------------- */
Also see: Tab Triggers