cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <section>
 <p id="watchme"></p>
   <p class="notice">This is still pretty buggy on mobile devices. Fixin' on a work.</p>
 <div class="box">
    <p><span>Poster with a forever looping gif on mouse-over.</span></p>
  <video preload="none" nocontrols data-teaser="http://nathanpjf.com/wp-content/uploads/images/joke.gif", data-preview="http://nathanpjf.com/wp-content/uploads/images/joke.png", poster="http://nathanpjf.com/wp-content/uploads/images/joke.png">
  <source src="http://nathanpjf.com/wp-content/uploads/videos/joke.mp4" type="video/mp4">
  <source src="http://nathanpjf.com/wp-content/uploads/videos/joke.theora.ogv" type="video/ogg">
</video>
  </div>
  
   <div class="box">
    <p><span>Poster with a gif that only plays once.</span></p>   
   <video width="200" preload="none" nocontrols data-teaser="http://nathanpjf.com/wp-content/uploads/images/icecream.gif", data-preview="http://nathanpjf.com/wp-content/uploads/images/icecream.png", poster="http://nathanpjf.com/wp-content/uploads/images/icecream.png">
  <source src="http://nathanpjf.com/wp-content/uploads/videos/icecream.mp4" type="video/mp4">
  <source src="http://nathanpjf.com/wp-content/uploads/videos/icecream.webm" type="video/webm">
<source src="http://nathanpjf.com/wp-content/uploads/videos/icecream.theora.ogv" type="video/ogg">
</video>
  </div>
  
   <div class="box">
    <p><span>Video whose poster image is larger than the video - but the video has a max-width. Cool. :)</span></p>
     <video nocontrols preload="none" data-teaser="https://i.imgur.com/Phzj0K7.gif", data-preview="https://i.imgur.com/xK4NvsM.png", poster="https://i.imgur.com/xK4NvsM.png">
  <source src="http://nathanpjf.com/wp-content/uploads/videos/Wedding video-1920.mp4" type="video/mp4">
  <source src="http://nathanpjf.com/wp-content/uploads/videos/Wedding video-1920.webm" type="video/webm">
<source src="http://nathanpjf.com/wp-content/uploads/videos/Wedding video-1920.theora.ogv" type="video/ogg">
</video>
  </div>
<!-- COOL LINKS -->
  
<!--  
Blog post: http://nathanpjf.com/fun-with-video-previews/

Preload attribute: http://www.stevesouders.com/blog/2013/04/12/html5-video-preload/
  
HTML5 Video API and Media events: http://www.w3.org/2010/05/video/mediaevents.html
-->
<!--  <div class="box">
    <p>-->
<!--      <button id="bad-button">Click to see a bad video setup.</button>-->
   <!--   <span>Oversized poster; NO max width. NOT Cool. >:0</span></p>
     <video id="bad-video" style="max-width: none;" nocontrols data-teaser="https://i.imgur.com/Phzj0K7.gif", data-preview="https://i.imgur.com/xK4NvsM.png", poster="https://i.imgur.com/xK4NvsM.png">
  <source src="http://nathanpjf.com/wp-content/uploads/videos/Wedding video-1920.mp4" type="video/mp4">
  <source src="http://nathanpjf.com/wp-content/uploads/videos/Wedding video-1920.webm" type="video/webm">
<source src="http://nathanpjf.com/wp-content/uploads/videos/Wedding video-1920.theora.ogv" type="video/ogg">
</video>
  </div>-->
  
</section>

            
          
!
            
              body{ 
  background: url('https://i.imgur.com/Nb8bcxR.png') black;
  min-height: 100%;
}

section{
//   height: 500px;
  width:100%;
  max-width: 800px;
  position:relative;
  margin: 120px auto;
}
p.notice{
  text-align: center;
  font-family: sans-serif;
  color: rgb(150, 16, 16);
  font-size: 18px;
  text-shadow: 1px 1px 0px white;
  padding: 20px;
  background: rgba(250,250,250,0.4);
}

.box{
  border-top: 6px double rgba(114, 27, 27, 0.3);;
  margin: 2em 0;
  padding: 2em;
  video{
    background: rgba(0,0,0,0);
    display: block;
    max-width: 500px;
    margin: 0 auto;
    padding-top: 25px;
  }

  p{
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    padding: 12px 20px;
    span{
      color: whitesmoke;
       text-shadow: 1px 1px rgba(0, 0, 0, 0.4);
      font-family: sans-serif;
      }
  }
}

#watchme{display:none;}

button#bad-button{
  padding:8px;
  font-size: 13px;
  display: block;
  margin: 0 auto 10px;
//  border-radius:12px;
}
            
          
!
            
              $( document ).ready(function() {
   // alert($('p#watchme').text());
  mobileWatch = $('p#watchme').text();
  var onMobile;
  
  if(mobileWatch.length < 15){
    //alert('On mobile');
    var onMobile = true;
  }else{
    //alert('Not on mobile');
    var onMobile = false;
  }
if (!onMobile){
  $( "video" ).mouseover(function() {
    $teaser= $(this).attr( 'data-teaser' );
    $(this).attr( 'controls',true );
    if ( this.paused ) { 
      $(this).attr( 'poster', $teaser );
    }
  });
  
  $( "video" ).mouseout(function() {
    $preview = $(this).attr( 'data-preview' );
    $(this).removeAttr( "controls" );
    if ( this.paused ) { 
      $(this).attr( 'poster', $preview ); 
    }
   });
}else{
 // alert('still on a mobile device.');
    $( "video" ).each(function() {
      $( this ).attr('controls',true);
    });
}
  
});


            
          
!
999px
Loading ..................

Console