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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              .video
  video(id="fs-video")    
    source(src="http://highwaywebconsulting.com/videos/JetSkiRiverSunset.compressed.mp4")
    
.menu-trigger
  p <i class="zmdi zmdi-menu"></i>
  
.menu
  .menu-close <i class="zmdi zmdi-close"></i>
  h1 What would you like to do?
  ul.menu-inner
    li(data-url="http://highwaywebconsulting.com/videos/JetSkiRiverSunset.compressed.mp4") Jet Ski
    li(data-url="http://highwaywebconsulting.com/videos/Ski_Run_Rear_View.mp4") Snow Ski
    li(data-url="http://highwaywebconsulting.com/videos/The_Flight_over_the_Willage.compressed.mp4") Fly
    
#controls
  button.go-button <i class="zmdi zmdi-play-circle-outline"></i>
  button.reset-button.hide <i class="zmdi zmdi-replay"></i>
  
.player-controls.hide
  button.play <i class="zmdi zmdi-play"></i>
  button.pause <i class="zmdi zmdi-pause"></i>
  button.replay <i class="zmdi zmdi-replay"></i>
  
            
          
!
            
              body
  margin: 0
  position: relative
  font-family: 'Lato', sans-serif

video
  position: fixed
  top: 50%
  left: 50%
  min-width: 100%
  min-height: 100%
  width: auto
  height: auto
  z-index: -100
  -ms-transform: translateX(-50%) translateY(-50%)
  -moz-transform: translateX(-50%) translateY(-50%)
  -webkit-transform: translateX(-50%) translateY(-50%)
  transform: translateX(-50%) translateY(-50%)
  
.menu-trigger
  position: fixed
  top: 0
  left: 0
  z-index: 100
  
  p
    margin: 0
    padding: 1rem
    font-size: 2rem
    color: white
    transition: color 300ms ease
    text-shadow: 1px 1px 5px rgba(black, 0.3)
    
    &:hover
      color: rgba(white, 0.8)
      cursor: pointer
    
.menu-close
  text-align: right
  padding: 1rem
  font-size: 2rem
  
  &:hover
    color: rgba(black, 0.6)
    cursor: pointer
  
.menu
  position: fixed
  top: 0
  left: -200px
  width: 200px
  background: #fff
  height: 100vh
  z-index: 200
  transition: all 500ms ease
  
  h1
    margin: 0
    line-height: 1
    font-size: 1.5rem
    padding: 1rem
    
@media (min-width: 900px)
  .menu
    left: -350px
    width: 350px
    
.menu-open
  left: 0
  
.menu-inner
  list-style: none
  padding: 1rem
  
  li
    margin: 1rem 0
    font-size: 2rem
    
    &:hover
      text-decoration: underline
      cursor: pointer
  
#controls
  position: absolute
  width: 100vw
  height: 100vh
  padding: 0
  margin: 0
  display: flex
  justify-content: center
  align-items: center
  z-index: 10
  
.go-button,
.reset-button
  background: transparent
  border: 0
  height: 50px
  width: 50px
  font-size: 4rem
  color: white
  transition: color 300ms ease
  
  &:hover
    color: rgba(white, 0.7)
  
video
  &::-webkit-media-controls
    display: none
  
.player-controls
  position: fixed
  bottom: 1rem
  right: 1rem
  z-index: 2147483647
  
  button
    background: transparent
    border: 1px solid white
    color: white
    padding: 1rem
    width: 50px
    height: 50px
    border-radius: 50%
    transition: background 300ms ease
    outline: transparent
  
    &:hover
      background: rgba(white, 0.2)
      
    &:nth-child(even)
      margin: 0 .5rem
  
  

  
.hide
  display: none
            
          
!
            
              var video = $('#fs-video');

// Menu trigger

$('.menu-trigger').on('click', function() {
  $('.menu').addClass('menu-open');
});

$('.menu-close').on('click', function() {
  $('.menu').removeClass('menu-open');
});

// Menu select
$('.menu-inner li').on('click', function() {
  var $this = $(this);
  var videoURL = $this.attr('data-url');
  console.log(videoURL);
  $('#fs-video source').attr('src', videoURL);
  video[0].load();
  $('.go-button').removeClass('hide');
  $('.reset-button').addClass('hide');
  $('.player-controls').addClass('hide');
  $('.menu').removeClass('menu-open');
});

// Go button controls
$('#controls button').on('click', function() {
  $(this).addClass('hide');
  $('.player-controls').removeClass('hide');
  video[0].play();
});

// When video has ended
video.on('ended', function() {
  $('.reset-button').removeClass('hide');
  $('.player-controls').addClass('hide');
});


// Player control functions

// play
$('.play').on('click', function() {
  video[0].play();
});

// pause
$('.pause').on('click', function() {
  video[0].pause();
});

// replay
$('.replay').on('click', function() {
  video[0].load()
  video[0].play();
});




            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console