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

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

* {
 box-sizing: border-box;
}

body {
 font-family: "Poppins", sans-serif;
 color: #444;
 box-sizing: border-box;
 margin: 0px;
}

img {
 max-width: 100%;
}

.model-watch {
 padding: 16px 20px;
 background-color: #000;
 display: flex;
 justify-content: center;
 color: #fff;
 max-width: 300px;
 margin: 10% auto;
 cursor: pointer;
}

/**Typeo CSS End**/
.model-overlay {
 pointer-events: none;
 opacity: 0;
 position: fixed;
 left: 0px;
 top: 0px;
 width: 100%;
 height: 100%;
 background-color: rgba(0, 0, 0, 0.8);
 z-index: 9999;
 transition: 0.5s all;
}

.model-popup {
 pointer-events: none;
 opacity: 0;
 transition: 0.5s all;
 max-width: 900px;
 width: 100%;
 position: fixed;
 left: 50%;
 top: 50%;
 z-index: 99999;
 transform: translate(-50%, -50%);
 background-color: #fff;
 padding: 30px;
}

.model-open .model-popup, .model-open .model-overlay {
 pointer-events: auto;
 opacity: 1;
}

.model-popup .model-close {
 background-color: #fff;
 width: 40px;
 height: 40px;
 display: inline-block;
 text-align: center;
 position: absolute;
 top: -20px;
 line-height: 1.8;
 right: -20px;
 font-size: 24px;
 cursor: pointer;
 box-shadow: #676767 1px 5px 6px;
 border-radius: 100%;
}

.model-inner {
 position: relative;
}

.model-img {
 width: 100%;
 display: block;
 opacity: 0;
}

.model-popup video {
 display: block;
 position: absolute;
 left: 0px;
 top: 0px;
 height: 100%;
 width: 100%;
}

@media(max-width:992px) {
 .model-popup {
  padding: 10px;
  width: calc(100% - 20px);
 }

 .model-popup .model-close {
  top: -34px;
  line-height: 1.4;
  right: -3px;
  width: 30px;
  height: 30px;
 }

}
JS
var playButton = document.getElementById("modelVideoPlay");
var pauseButton = document.getElementById("pause_button");
playButton.addEventListener("click", function() {
  video.currentTime = 0;
  video.play();
  document.querySelector('html').classList.add('model-open');
});

pauseButton.addEventListener("click", function() {
	video.pause();
	document.querySelector('html').classList.remove('model-open')
});

Related Snippets

Leave a comment

Your email address will not be published. Required fields are marked *