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

              
                <video id="v0" preload autoplay loop>
  <source type="video/mp4" src="https://assets.nflallday.com/editions/marquee/fe481ef0-8396-4240-bd0a-a5fa525d8fdf/play_fe481ef0-8396-4240-bd0a-a5fa525d8fdf_marquee_capture_AnimationCapture_Video_Idle_Black_1080_1080_Black.mp4">
  <source type="video/mp4" src="https://assets.nflallday.com/editions/genesis/a39de8cc-d2cb-4bf6-acd1-ffdce7e0e2b2/play_a39de8cc-d2cb-4bf6-acd1-ffdce7e0e2b2_genesis_capture_AnimationCapture_Video_Square_Black_1080_1080_Black.mp4">
</video>

<video id="moment_vid" preload autoplay>
  <source type="video/mp4" src="https://assets.nflallday.com/editions/marquee/fe481ef0-8396-4240-bd0a-a5fa525d8fdf/play_fe481ef0-8396-4240-bd0a-a5fa525d8fdf_marquee_capture_AnimationCapture_Video_Square_Black_1080_1080_Black.mp4">
</video>
<div id="button-container">
  <button id="view-moment-button">
      <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 20 24" fill="none" stroke="#FF3100" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><polygon points="5 3 19 12 5 21 5 3"></polygon></svg>
  </button>
    <span tooltip="commentary on/off" flow="right"><button id="audio-button">    
      <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 20 24" fill="none" stroke="#FF3100" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
  <path stroke-linecap="round" stroke-linejoin="round" d="M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z" />
</svg></span>
  </div>
  </button>
</div>
  <h2> Drag your finger or mouse to rotate</h2>

              
            
!

CSS

              
                body {
  position: relative;
  overflow-x: hidden;
  background: #000;
  margin: 0;
  font-family: 'Raleway', sans-serif;
  font-size: 12px;
  color: #535353;
}

h2 {
  font-weight: 200;
  margin: 1em 0;
  text-align: center;
}

video {
  max-height: 100%;
  max-width: 80%;
  display: none;
  justify-content: center;
  align-items: center;
  width: 80vh;
  margin: 0 auto;
  padding-top:10px;
}


#button-container {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

h2{
  padding-top:20px;
}

  #view-moment-button {
    position: relative;
    z-index: 1;
    float: left;
    display: inline-block;
    font-size: 6px;
    font-weight: 900;
    text-transform: uppercase;
    color: #FF3100;
    padding: 6px 38px;
    cursor: pointer;
    transition: all .3s ease-in-out;
    line-height: .95;
    border: none;
    background: none;
    outline: none;
    border: 1px solid #FF3100;
    border-radius: 30px;
    overflow: hidden;
    
    & .bg {
      width: 101%;
      height: 101%;
      display: block!important;
      z-index: -1;
      opacity: 0;
      transition: all .1s ease-in-out;
      background: linear-gradient(135deg, #a61322, #d33f34);
    }
    
    &:hover {
      color: #fff!important;
      border: 1px solid transparent!important;
      
      & .bg {
        opacity: 1;
      }
    }}


#view-moment-button:before
{
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    bottom: -5px;
    right: -5px;
    z-index: -1;
    background: linear-gradient(90deg, rgb(243, 78, 75), rgb(255, 143, 17));
    background-size: 300%;
    border-radius: 40px;
    opacity: 0;
    transition: 0.25s;
}

#view-moment-button:hover:before
{
    filter: blur(20px);
    opacity: 1;
}

  #audio-button {
    position: relative;
    z-index: 1;
    float: right;
    display: inline-block;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    color: #FF3100;
    padding: 8px 10px 8px 8px;
    margin-left:12px;
    cursor: pointer;
    transition: all .3s ease-in-out;
    line-height: .95;
    border: none;
    background: none;
    outline: none;
    border: 1px solid #FF3100;
    border-radius: 30px;
    overflow: hidden;
    
    & .bg {
      width: 101%;
      height: 101%;
      display: block!important;
      z-index: -1;
      opacity: 0;
      transition: all .1s ease-in-out;
      background: linear-gradient(135deg, #a61322, #d33f34);
    }
    
    &:hover {
      color: #fff!important;
      border: 1px solid transparent!important;
      
      & .bg {
        opacity: 1;
      }
    }}


#audio-button:before
{
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    bottom: -5px;
    right: -5px;
    z-index: -1;
    background: linear-gradient(90deg, rgb(243, 78, 75), rgb(255, 143, 17));
    background-size: 300%;
    border-radius: 40px;
    opacity: 0;
    transition: 0.25s;
}

#audio-button:hover:before
{
    filter: blur(20px);
    opacity: 1;
    animation: animate 2s linear infinite;
}



/* START TOOLTIP STYLES */
[tooltip] {
  position: relative; /* opinion 1 */
}

/* Applies to all tooltips */
[tooltip]::before,
[tooltip]::after {
  text-transform: none; /* opinion 2 */
  line-height: 1;
  user-select: none;
  pointer-events: none;
  position: absolute;
  display: none;
  opacity: 0;
}
[tooltip]::before {
  content: '';
  border: 5px solid transparent; /* opinion 4 */
  z-index: 1001; /* absurdity 1 */
}
[tooltip]::after {
  content: attr(tooltip); /* magic! */
  
  /* 
    Let the content set the size of the tooltips 
    but this will also keep them from being obnoxious
    */
  min-width: 3em;
  max-width: 21em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 1ch 1.5ch;
  border-radius: .3ch;
  box-shadow: 0 1em 2em -.5em rgba(0, 0, 0, 0.35);
  background: #333;
  color: #fff;
  z-index: 99999; /* absurdity 2 */
}

/* Make the tooltips respond to hover */
[tooltip]:hover::before,
[tooltip]:hover::after {
  display: block;
}

/* don't show empty tooltips */
[tooltip='']::before,
[tooltip='']::after {
  display: none !important;
}

/* FLOW: RIGHT */
[tooltip][flow^="right"]::before {
  top: 50%;
  border-left-width: 0;
  border-right-color: #333;
  right: calc(0em - 5px);
  transform: translate(.5em, -50%);
}
[tooltip][flow^="right"]::after {
  top: 50%;
  left: calc(100% + 5px);
  transform: translate(.5em, -50%);
}

/* KEYFRAMES */
@keyframes tooltips-vert {
  to {
    opacity: .9;
    transform: translate(-50%, 0);
  }
}

@keyframes tooltips-horz {
  to {
    opacity: .9;
    transform: translate(0, -50%);
  }
}

/* FX All The Things */ 
[tooltip]:not([flow]):hover::before,
[tooltip]:not([flow]):hover::after,
[tooltip][flow^="up"]:hover::before,
[tooltip][flow^="up"]:hover::after,
[tooltip][flow^="down"]:hover::before,
[tooltip][flow^="down"]:hover::after {
  animation: tooltips-vert 300ms ease-out forwards;
}

[tooltip][flow^="left"]:hover::before,
[tooltip][flow^="left"]:hover::after,
[tooltip][flow^="right"]:hover::before,
[tooltip][flow^="right"]:hover::after {
  animation: tooltips-horz 300ms ease-out forwards;
}










              
            
!

JS

              
                $(document).ready(function() {
  var isTouching = false;
  var touchX = 0;
  var scrollSpeed = 0.1;
  var keyState = {};

  var vid = document.getElementById("v0");
  var momentVid = document.getElementById("moment_vid");
  var viewMomentButton = document.getElementById("view-moment-button");
  var timeline = document.getElementById('video-timeline');

  vid.pause();
  momentVid.pause();
  momentVid.style.display = "none";

  var $cursorArea = $(document);

  $cursorArea.on("touchstart mousedown", function(e) {
    isTouching = true;
    touchX = e.pageX || e.originalEvent.touches[0].pageX;

    $cursorArea.on("touchmove mousemove", function(e) {
      var currentX = e.pageX || e.originalEvent.touches[0].pageX;

      var video = vid.style.display === "block" ? vid : momentVid;

      if (currentX < touchX) {
        video.currentTime -= scrollSpeed;
        if (video.currentTime <= 0) {
          video.currentTime = video.duration - scrollSpeed;
        }
      } else if (currentX > touchX) {
        video.currentTime += scrollSpeed;
      }

      touchX = currentX;
    });
  });

  $cursorArea.on("touchend mouseup", function() {
    isTouching = false;
    $cursorArea.off("touchmove mousemove");
  });

  function loop() {
    if (isTouching) {
      var video = vid.style.display === "block" ? vid : momentVid;

      if (keyState[37] || keyState[65]) {
        video.currentTime -= scrollSpeed;
        if (video.currentTime <= 0) {
          video.currentTime = video.duration - scrollSpeed;
        }
      }
      if (keyState[39] || keyState[68]) {
        video.currentTime += scrollSpeed;
      }
    }
    requestAnimationFrame(loop);
  }
  loop();

  window.addEventListener("keydown", function(e) {
    keyState[e.keyCode || e.which] = true;
  }, true);

  window.addEventListener("keyup", function(e) {
    keyState[e.keyCode || e.which] = false;
  }, true);

  vid.addEventListener("ended", function() {
    vid.currentTime = 0;
    vid.play();
  });

var viewMomentButton = document.getElementById("view-moment-button");
var returnButtonSVG = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 20 24" fill="none" stroke="#FF3100" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><polygon points="5 3 19 12 5 21 5 3"></polygon></svg>';
var backButtonSVG = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#FF3100" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M2.5 2v6h6M2.66 15.57a10 10 0 1 0 .57-8.38"/></svg>';

viewMomentButton.addEventListener("click", function() {
  if (vid.style.display === "none") {
    vid.style.display = "block";
    vid.pause();
    momentVid.style.display = "none";
    viewMomentButton.innerHTML = returnButtonSVG;
  } else {
    vid.style.display = "none";
    vid.pause();
    momentVid.style.display = "block";
    momentVid.currentTime = 0;
    momentVid.play();
    viewMomentButton.innerHTML = backButtonSVG;
  }
});



  momentVid.addEventListener("ended", function() {
    momentVid.currentTime = 0;
    momentVid.pause();
  });

  momentVid.addEventListener("pause", function() {
    momentVid.currentTime = 0;
  });

  momentVid.addEventListener('timeupdate', function() {
    var currentTime = momentVid.currentTime;
    var duration = momentVid.duration;
    var progress = (currentTime / duration) * 100;
  });

  momentVid.addEventListener('loadedmetadata', function() {
    momentVid.currentTime = 0;
    momentVid.pause();
  });
  // Additional code to ensure "v0" is displayed when the page is first loaded
  vid.style.display = "block";
  momentVid.style.display = "none";

  // Store the original state
  var originalState = {
    vidDisplay: "block",
    momentVidDisplay: "none"
  };

  function setOriginalState() {
    vid.style.display = originalState.vidDisplay;
    momentVid.style.display = originalState.momentVidDisplay;
    vid.pause();
    momentVid.pause();
    momentVid.currentTime = 0;
    viewMomentButton.textContent = "View Moment";
  }

  // Restore original state when "Return" button is clicked
var returnButton = document.getElementById("viewMomentButton");
returnButton.addEventListener("click", function() {
  var v0 = document.getElementById("v0");
  var momentVid = document.getElementById("moment_vid");

  if (v0.style.display === "none") {
    v0.style.display = "block";
    momentVid.style.display = "none";
  } else {
    v0.style.display = "none";
    momentVid.style.display = "block";
  }
});

  // Update original state when "View Moment" button is clicked
  viewMomentButton.addEventListener("click", function() {
    if (vid.style.display === "none") {
      originalState.vidDisplay = "none";
      originalState.momentVidDisplay = "block";
      setOriginalState();
    } else {
      originalState.vidDisplay = "block";
      originalState.momentVidDisplay = "none";
      vid.style.display = "none";
      momentVid.style.display = "block";
      momentVid.currentTime = 0;
      momentVid.play();
      viewMomentButton.textContent = "Return";
    }
  });
});


              
            
!
999px

Console