Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

Save Automatically?

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

              
                <h1>Click to play the video (Use any custom overlay you want) </h1>
<h2>sound mute</h2>
<main>

  <div class="wrapper">
    <div style="padding:56.25% 0 0 0;position:relative;"><iframe src="https://player.vimeo.com/video/340519341" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0" allow=" fullscreen" allowfullscreen></iframe></div>
    <div class="overlay">
      <div>
        <h3>Overlay 1 (click to play)</h3>
        <p>video description</p>
        <button>Play 1</button>
      </div>
    </div>
  </div>

  <div class="wrapper">
    <div style="padding:56.25% 0 0 0;position:relative;">
      <iframe src="https://player.vimeo.com/video/309779269" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe></div>
    <div class="overlay">
      <div>
        <h3>Overlay 2 (click to play)</h3>
        <p>video description</p>
        <button>Play 2</button>
      </div>
    </div>
  </div>

  <div class="wrapper">
    <div style="padding:56.25% 0 0 0;position:relative;">
      <iframe src="https://player.vimeo.com/video/270010765" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe></div>
    <div class="overlay">
      <div>
        <h3>Overlay 3 (click to play)</h3>
        <p>video description</p>
        <button>Play 3</button>
      </div>
    </div>
  </div>

  <div class="wrapper">
    <div style="padding:56.25% 0 0 0;position:relative;">
      <iframe src="https://player.vimeo.com/video/269483746" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe></div>
    <div class="overlay">
      <div>
        <h3>Overlay 4 (click to play)</h3>
        <p>video description</p>
        <button>Play 4</button>
      </div>
    </div>
  </div>

</main>
<script src="https://player.vimeo.com/api/player.js">
  < /script
              
            
!

CSS

              
                main{
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
main .wrapper{
  flex-basis: 49%;
}

@media only screen and (max-width: 600px) {
main .wrapper{
  flex-basis: 100%;
}
}

.wrapper{
  position: relative;
  margin-bottom: 15px;
}
.overlay{
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  color: white;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  right:0;
  top: 0;
  bottom:0;
  background-color: rgba(22,0,77,0.7);
  z-index: 5000;
  text-align: center;
  cursor: pointer;
}

button {
  background-color: #4CAF50; /* Green */
  border: none;
  color: white;
  padding: 9px 25px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  cursor: pointer;
}
              
            
!

JS

              
                /* VIEMO Iframe Setting */
var iframe = $("iframe");

iframe.each(function(index) {
  /* you should change the overlayDiv selector if you change the html strcture */
  var overlayDiv = $(this).parent().next().hide();
  
  /* create list of objects */
  var player = new Vimeo.Player($(this));

  player.on("play", function() {
    console.log("Played the video");
    overlayDiv.hide();
  });

  player.unload().then(function() {
    // The video has been unloaded
    overlayDiv.show();
  });

  /* not Viemo API - custom click event for the relevant overlay */
  overlayDiv.click(function(event) {
    $(".overlay").show();
    overlayDiv.hide();
    /* autoplay wont work without video sound mute */
    player.setVolume("0");
    /* setCurrentTime 0 (Remove this line if you want "on click" return to last video time) */
    player.setCurrentTime("0");
    player.play();
  });
});

              
            
!
999px

Console