Coder Wrap provides free to use snippets Coder Wrap provides free to use snippets

Back to Web elements
Preview Source Code
Download
HTML
CSS
	/**Typeo CSS Start**/
@import url('https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,400;0,500;0,700;0,800;1,300;1,400;1,500;1,600;1,700&display=swap');

* {
 box-sizing: border-box;
}

body {
 margin: 0px;
 background-color: #fff;
}

/**Typeo CSS End**/
.video-scn, .video-scn * {
 --page-width: 1330px;
 --base-fm: 'Rubik', sans-serif;
 --title-size: 26px;
 --base-size: 16px;
 --white-clr: #ffffff;
 --theme-clr: #c25b41;
 --bg-clr: #000000;
}

.video-scn {
 width: 100%;
 position: relative;
 font-family: var(--base-fm);
 display: flex;
 flex-flow: row wrap;
 justify-content: center;
 align-items: center;
 padding: 50px 0;
}

.page-width {
 max-width: var(--page-width);
 margin: auto;
 width: 100%;
}

.video-scn img {
 width: 100%;
 height: auto;
 opacity: 1;
}

.videohere {
 width: 100%;
 position: relative;
}

.videoprt {
 width: 100%;
 object-fit: cover;
 height: 100%;
 position: absolute;
 left: 0px;
 top: 0px;
}

.video-cont {
 position: absolute;
 left: 50%;
 top: 50%;
 transform: translate(-50%, -50%);
 z-index: 5;
}

.video-cont .videoplay-btn {
 display: flex;
 flex-flow: row wrap;
 align-items: center;
 justify-content: center;
 cursor: pointer;
}

.video-cont .videoplay-btn .video-icon {
 width: 60px;
 height: 60px;
 background-color: var(--white-clr);
 border-radius: 100%;
 margin-right: 15px;
 position: relative;
}

.video-cont .videoplay-btn .video-icon:before {
 content: '';
 position: absolute;
 left: 3px;
 right: 0px;
 bottom: 0px;
 top: 1px;
 width: 0;
 height: 0;
 border-style: solid;
 border-width: 10px 0 10px 18px;
 border-color: transparent transparent transparent var(--theme-clr);
 margin: auto;
}

.videomodel-show img {
 opacity: 0;
}

.videomodel-show .videohere .video-icon {
 opacity: 0;
}

.videohere video {
 opacity: 0;
}

.videomodel-show .videohere video {
 opacity: 1;
}
JS
//Video Open
let video_btn = document.querySelector('.videoplay-btn');
let video_model = document.querySelector('.video-scn');
let datavideo = video_btn.getAttribute('data-video');
let video_source = document.querySelector('.videoprt');
video_btn.addEventListener('click', function(){
 video_model.classList.add('videomodel-show');
 video_source.setAttribute('src',datavideo);
});

Related Web Elements