Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="popmechanic-form" class="popmechanic-reset video-widget" data-state="default">

  <div class="video-widget__container mutted">
    <video data-popmechanic-submit id="video-widget__video" loop="" autoplay="" playsinline="" muted="muted" preload="auto" controlslist="nodownload" disablepictureinpicture="" class="video-widget__video">
      <source src="https://u.netology.ru/backend/uploads/page_assets/videos/file/55087/anim.mp4" type="video/mp4">
    </video>
    <div class="popmechanic-close" data-popmechanic-close><svg width="14" height="14" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
        <path d="M18 0.818077L17.1819 0L9 8.18192L0.818077 0L0 0.818077L8.18192 9L0 17.1819L0.818077 18L9 9.81808L17.1819 18L18 17.1819L9.81808 9L18 0.818077Z" fill="#FFFFFF" />
      </svg>
    </div>

  </div>

</div>
</div>

<script>
  var e = document.querySelector('.video-widget'),
    a = document.getElementById('video-widget__video'),
    c = document.querySelector(".video-widget__container")
  document.querySelector('.video-widget__container').addEventListener('click', function(t) {
    if (e.getAttribute('data-state') === 'default') {
      e.setAttribute('data-state', 'opened');
      c.classList.add("new")
      a.currentTime = 0;
      a.muted = false;
    } else {
      e.setAttribute('data-state', 'default');
      c.classList.remove("new")
      a.muted = true;
    }
  });
  // document.querySelector('.video-widget__container').addEventListener('touchstart', function(t) {
  //     if (e.getAttribute('data-state') === 'default') {
  //         e.setAttribute('data-state', 'opened');
  //         c.classList.add("new")
  //         a.currentTime = 0;
  //         a.muted = false;
  //     } else {
  //         e.setAttribute('data-state', 'default');
  //         c.classList.remove("new")
  //         a.muted = true;
  //     }
  // });
  document.addEventListener('mouseup', function(t) {
    if (!e.contains(t.target) && e.getAttribute('data-state') !== 'default') {
      e.setAttribute('data-state', 'default');
      a.muted = true;
    }
  });
  // document.addEventListener('touchend',function(t)  {
  //     if (!e.contains(t.target) && e.getAttribute('data-state') !== 'default') {
  //         e.setAttribute('data-state', 'default');
  //         a.muted = true;
  //     }
  // });
</script>
              
            
!

CSS

              
                #popmechanic-form .video-widget {
  position: fixed;
  left: 0;
  z-index: 999999;
  bottom: 0;
}
#popmechanic-form .video-widget__container {
  font-family: Helvetica;
  z-index: 999999;
  overflow: hidden;
  border-style: solid;
  background: #eee;
  -webkit-transition: width 0.3s ease-in-out 0s, height 0.3s ease-in-out 0s,
    bottom 0.3s ease-in-out 0s, border-color 0.2s ease-in-out 0s,
    opacity 1s ease-in-out 0s, -webkit-transform 0.2s ease-in-out 0s;
  transition: width 0.3s ease-in-out 0s, height 0.3s ease-in-out 0s,
    bottom 0.3s ease-in-out 0s, border-color 0.2s ease-in-out 0s,
    opacity 1s ease-in-out 0s, -webkit-transform 0.2s ease-in-out 0s;
  -o-transition: width 0.3s ease-in-out 0s, height 0.3s ease-in-out 0s,
    bottom 0.3s ease-in-out 0s, border-color 0.2s ease-in-out 0s,
    opacity 1s ease-in-out 0s, -o-transform 0.2s ease-in-out 0s;
  -moz-transition: transform 0.2s ease-in-out 0s, width 0.3s ease-in-out 0s,
    height 0.3s ease-in-out 0s, bottom 0.3s ease-in-out 0s,
    border-color 0.2s ease-in-out 0s, opacity 1s ease-in-out 0s,
    -moz-transform 0.2s ease-in-out 0s;
  transition: transform 0.2s ease-in-out 0s, width 0.3s ease-in-out 0s,
    height 0.3s ease-in-out 0s, bottom 0.3s ease-in-out 0s,
    border-color 0.2s ease-in-out 0s, opacity 1s ease-in-out 0s;
  transition: transform 0.2s ease-in-out 0s, width 0.3s ease-in-out 0s,
    height 0.3s ease-in-out 0s, bottom 0.3s ease-in-out 0s,
    border-color 0.2s ease-in-out 0s, opacity 1s ease-in-out 0s,
    -webkit-transform 0.2s ease-in-out 0s, -moz-transform 0.2s ease-in-out 0s,
    -o-transform 0.2s ease-in-out 0s;
  outline: 0;
  cursor: pointer;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 10px 20px;
  box-shadow: rgba(0, 0, 0, 0.2) 0 10px 20px;
  position: absolute;
  left: 20px;
  bottom: 50px;
  border-radius: 20px;
  border-width: 5px;
  width: 130px;
  height: 180px;
  border-color: #fff;
}

#popmechanic-form .video-widget__container:hover {
  -webkit-transform: scale(1.05) translate(5px, -5px);
  -moz-transform: scale(1.05) translate(5px, -5px);
  -ms-transform: scale(1.05) translate(5px, -5px);
  -o-transform: scale(1.05) translate(5px, -5px);
  transform: scale(1.05) translate(5px, -5px);
  border-color: #131344;
}

#popmechanic-form .video-widget__video {
  -o-object-fit: cover;
  object-fit: cover;
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
  -moz-transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  -o-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  z-index: 200;
  -webkit-transition: opacity 0.4s ease-in-out 0s;
  -o-transition: opacity 0.4s ease-in-out 0s;
  -moz-transition: opacity 0.4s ease-in-out 0s;
  transition: opacity 0.4s ease-in-out 0s;
  opacity: 0.9;
  z-index: 0;
}
#popmechanic-form
  .video-widget__container:hover
  #popmechanic-form
  .video-widget.video-widget[data-state="opened"]
  .video-widget__container {
  width: 400px;
  height: 600px;
  border-radius: 20px;
  border-color: #fff;
}
#popmechanic-form .video-widget__button {
  position: absolute;
  bottom: 20px;
  right: 20px;
  left: 20px;
  height: 65px;
  border-radius: 10px;
  z-index: 300;
  -webkit-box-shadow: rgba(0, 0, 0, 0.25) 0 4px 15px;
  box-shadow: rgba(0, 0, 0, 0.25) 0 4px 15px;
  text-align: center;
  -webkit-transition: opacity 0.3s ease-in-out 0s,
    background-color 0.2s ease-in-out 0s, -webkit-transform 0.2s ease-in-out 0s;
  transition: opacity 0.3s ease-in-out 0s, background-color 0.2s ease-in-out 0s,
    -webkit-transform 0.2s ease-in-out 0s;
  -o-transition: opacity 0.3s ease-in-out 0s,
    background-color 0.2s ease-in-out 0s, -o-transform 0.2s ease-in-out 0s;
  -moz-transition: transform 0.2s ease-in-out 0s, opacity 0.3s ease-in-out 0s,
    background-color 0.2s ease-in-out 0s, -moz-transform 0.2s ease-in-out 0s;
  transition: transform 0.2s ease-in-out 0s, opacity 0.3s ease-in-out 0s,
    background-color 0.2s ease-in-out 0s;
  transition: transform 0.2s ease-in-out 0s, opacity 0.3s ease-in-out 0s,
    background-color 0.2s ease-in-out 0s, -webkit-transform 0.2s ease-in-out 0s,
    -moz-transform 0.2s ease-in-out 0s, -o-transform 0.2s ease-in-out 0s;
  visibility: hidden;
  background-color: #fdd82a;
  font-size: 14px;
  font-family: Helvetica;
  color: #000;
  text-align: center;
  vertical-align: middle;
  line-height: 65px;
  text-transform: uppercase;
  opacity: 0;
}
#popmechanic-form .video-widget__button:hover {
  background-color: #ffe257;
  text-decoration: none;
}
#popmechanic-form
  .video-widget.video-widget[data-state="opened"]
  .video-widget__button {
  opacity: 1;
  visibility: visible;
  width: 400px;
  height: 600px;
}
@media only screen and (max-width: 1023px) @media only screen and (max-width: 479px) {
  #popmechanic-form .video-widget__container {
    left: 15px;
    bottom: 95px;
    width: 90px;
    height: 125px;
  }
}

#popmechanic-form .popmechanic-close {
  color: white;
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  text-align: center;
  width: 14px;
  height: 14px;
  z-index: 1;
}

#popmechanic-form .new {
  height: 400px;
  width: 250px;
}

              
            
!

JS

              
                
              
            
!
999px

Console