css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

            
              <div class="row mt-5 mb-5 ml-0 mr-0" style="background:#ededed">
  <div class="container mt-5 mb-5" style="max-width:900px">

    <!-- A container row with equal height children -->
    <div class="row p-3 fill-height-or-more">

      <!-- Left column for our index -->
      <div class="col-3 card" id="index-wrapper">
        <div id="video-index">
          <h6>Index</h6>
          <ol>
            <li><a href="#0:00">Intro</a></li>
            <li><a href="#2:08">Section 1</a></li>
            <li><a href="#3:08">Section 2</a></li>
            <li><a href="#4:18">Section 3</a></li>
            <li><a href="#5:35">Section 4</a></li>
            <li><a href="#6:08">Section 5</a></li>
            <li><a href="#6:28">Section 6</a></li>
            <li><a href="#7:08">Section 7</a></li>
            <li><a href="#9:08">Section 8</a></li>
            <li><a href="#10:08">Section 9</a></li>
            <li><a href="#11:08">Section 10</a></li>
            <li><a href="#12:08">Section 11</a></li>
            <li><a href="#12:51">Section 12</a></li>
            <li><a href="#13:08">Section 13</a></li>
            <li><a href="#13:37">Section 14</a></li>
            <li><a href="#13:52">Section 15</a></li>
            <li><a href="#14:12">Section 16</a></li>
            <li><a href="#14:23">Section 17</a></li>
            <li><a href="#14:38">Section 18</a></li>
            <li><a href="#14:59">Outro</a></li>
          </ol>
        </div>
      </div>

      <!-- Right column for our video -->
      <div class="col-9">
        <div class="video-wrapper">
          <div id="youtube-player"></div>
        </div>
      </div>

    </div>
  </div>
</div>
            
          
!
            
              .video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    padding-top: 25px;
    height: 0;
}
.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.fill-height-or-more{
  justify-content: space-between;
  display: flex;
}

#index-wrapper{
  overflow-y:scroll;
}

#video-index{
    position:absolute;
    top:20px;
    left:15px;
    width:calc(100% - 30px);
    padding:0;
}

#video-index ol{
  padding-left:35px;
  font-family: monospace;
  font-size:13px;
}

#video-index ol a:hover{
  text-decoration:none;
  color: #999000;
}

#video-index ol a .time{
  margin-left: 10px;
  color: #b2b2b2;
  font-size:12px;
  display:none;
}

#video-index ol a:hover .time{
  display:initial;
  text-decoration:none;
}
            
          
!
            
              //Youtube video id
var VIDEO_ID = 'CUfTu9r_64M';

// This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

// This function creates an <iframe> (and YouTube player)
// after the API code downloads.
var youtubePlayer;
function onYouTubeIframeAPIReady() {
    youtubePlayer = new YT.Player('youtube-player', {
        height: '390',
        width: '640',
        videoId: VIDEO_ID,
    });
}


jQuery(function() {
    jQuery('#video-index a').each(function(){  
      var $link = jQuery(this);
      
      $link.unbind('click')
        .append('<span class="time">' + jQuery(this).attr('href')
              .replace('#', '') + '</span>')        
        .on('click', function(e){
            e.preventDefault();   
        
            // Convert to seconds
            var hrefVal = jQuery(this).attr('href')
              .replace('#', '').split(":");
            var goToSec = parseInt(hrefVal[0]) * 60 + parseInt(hrefVal[1]);

            // Go to that second
            youtubePlayer.seekTo(goToSec);        
        });
    })
});
            
          
!
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.
Loading ..................

Console