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.

              <figure id="video-track-container">
  <video controls id="downtown-los-angeles" autoplay >
    <source src="https://thenewcode.com/assets/videos/downtown-los-angeles.webm">
    <source src="https://thenewcode.com/assets/videos/downtown-los-angeles.mp4">        <track kind="chapters" label="Locations" src="http://thenewcode.com/assets/videos/downtown-los-angeles-locations.vtt" srclang="en" default type="text/vtt" >
  <figcaption tabindex="0" role="menu" aria-label="Message Log">
    <ol id="chapters">

              * { 
  box-sizing: border-box;
  font-family: Avenir, Helvetica, sans-serif;
body { margin: 0; }
figure#video-track-container { 
  font-size: 0; 
  position: relative; 
  background: #000; 
  margin: 0; 
figure#video-track-container video { 
  width: 75%;
  height: auto;
  display: inline-block; 
figure#video-track-container figcaption { 
  position: absolute; 
  right: 0; top: 0;
  background: #222; 
  width: 25%; 
  font-size: .8rem; 
  color: #666; 
  height: 100%; 
  overflow-y: scroll; 
figure#video-track-container figcaption ol { 
  position: relative;
  list-style-type: none;
  margin: 0; 
  padding: 0; 
figure#video-track-container figcaption ol li a { 
  display: block; 
  padding: .7rem 1rem; 
  border-bottom: 1px dashed #000; 
  transition: .3s;
.current { 
  background: hsl(45,80%,50%); 
  color: #000;  
figure#video-track-container figcaption ol li a:not(.current):hover, 
figure#video-track-container figcaption ol li a:not(.current):focus { 
  background: hsl(45,80%,30%); 
  color: #000; 
  cursor: pointer;
figure#video-track-container figcaption::-webkit-scrollbar {
    width: 13px;
    height: 100%;
figure#video-track-container figcaption::-webkit-scrollbar-track {
    background-color: #000; 
figure#video-track-container figcaption::-webkit-scrollbar-thumb:vertical {
    background: hsl(45,80%,20%);
    width: 13px;
    height: 20px;

@media screen and (max-width: 500px) {
  figure#video-track-container video, 
  figure#video-track-container figcaption { 
    display: block; 
    width: 100%;
  figure#video-track-container video { 
    border-bottom: 10px solid #111;
figure#video-track-container figcaption { 
  position: static; 
  height: 200px;

              // Tracks are currently offline due to cross-origin issues

var locationList = document.getElementById("chapters"),
video = document.getElementById("downtown-los-angeles"),
trackElement = video.getElementsByTagName("track")[0];
video.addEventListener("loadedmetadata", function run_tests() {
      if (trackElement.readyState == 1) { setTimeout(run_tests, 0); } else { displayChapters(); }

function displayChapters(){
  if ((trackElement.readyState == 2) && (textTrack = trackElement.track) && (window.matchMedia("(min-width: 500px)").matches)){
        if(textTrack.kind === "chapters"){
            textTrack.mode = 'hidden';
            for (var i = 0; i < textTrack.cues.length; ++i) {
                var cue = textTrack.cues[i],
                chapterName = cue.text,
                start = cue.startTime,
                newLocale = document.createElement("li"),
                location = document.createElement("a");
                location.setAttribute('id', start);
                location.setAttribute('tabindex', '0');
                var localeDescription = document.createTextNode(cue.text);
                function() {
                	video.currentTime = this.id;
                }, false);
		   function() {
                var currentLocation = this.activeCues[0].startTime;
                if (chapter = document.getElementById(currentLocation)) {
                	var locations = [].slice.call(document.querySelectorAll("#chapters li a"));
                	for (var i = 0; i < locations.length; ++i) { locations[i].classList.remove("current"); } 
                  // locationlist.style.top = "-"+chapter.parentNode.offsetTop+"px";
                  // alternative approach, as scrollIntoView will cause entire page to jump if video is not at top of page
🕑 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.