123

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.

            
              <h1>Nakome Music videos</h1>

<ul class="youtube_videos">
  <li class="youtube" id="cZM3UNR3-Mg"></li>
  <br>
  <li class="youtube" id="fsjfEbDxcrc"></li>
    <br>
  <li class="youtube" id="xS_A8bkO8GQ"></li>
      <br>
  <li class="youtube" id="EmdEhn7Sf40"></li>
        <br>
  <li class="youtube" id="4NckFt4Bu0Q"></li>
          <br>
  <li class="youtube" id="JIVkN2KsvGU"></li>
  <li class="youtube" id="XSTGMNMdFac"></li>
  <li class="youtube" id="-ADp-gb92bw"></li>
</ul>




            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Racing+Sans+One);
body{
  background:#2c3e50;
  margin:0 auto;
  padding:0;
  text-align:center;
}
h1{
  text-align:center;
  color:#ecf0f1;
  font-family:'Racing Sans One', cursive;
  text-shadow:0 2px 2px #0c0e50;
}
.youtube_videos{
  list-style:none;
  margin:0 auto;
  display:block;
  padding:0;
}
.youtube_videos .youtube{
  display:inline-block;
  margin-bottom:1em;
  margin-right:0.5em;
  margin-left:0.5em;
  margin-top:0;
  
}
.youtube,.thumb{
  width:380px;
  height:250px;
  cursor:pointer;
  position:relative;
  -webkit-box-shadow:0 0.5px 2px #1D242B;
  -moz-box-shadow:0 0.5px 2px #1D242B;
  box-shadow:0 0.5px 2px #1D242B;
}
.youtube_video{
  width:385px;
  height:250px;
}
.thumb,.youtube_video{
  padding:5px;
  background:#34495e;
  border:0;
  outline:0;
}
.youtube:after{
  content:"PLAY THIS VIDEO";
  position:absolute;
  top:5px;
  left:5px;
  width:370px;
  height:240px;
  padding:0;
  margin:0;
  padding:5px;
  background:rgba(38, 180, 174, 0.66);
  text-align:center;
  line-height:250px;
  font-family:'Racing Sans One', cursive;
  color:transparent;
  -webkit-transition:all 0.8s ease;
  -moz-transition:all 0.8s ease;
  -o-transition:all 0.8s ease;
  transition:all 0.8s ease;
}
.youtube:hover:after{
  top:110px;
  left:110px;
  width:165px;
  height:40px;
  line-height:40px;
  background:#34495e;
  -webkit-transition:all 0.8s ease;
  -moz-transition:all 0.8s ease;
  -o-transition:all 0.8s ease;
  transition:all 0.8s ease;
  color:#ecf0f1;
}


/* = Responsive comming soon :)
---------------------------------*/
/* Desktop */
@media (min-width:980px) {}
/* Mobile */
@media (max-width:480px) {}
/* Tablet */
@media (max-width:767px) {}
@media (min-width:768px) and (max-width:979px) {}
            
          
!
            
              // Loop selectors
var videos = document.querySelectorAll(".youtube");  
for (var i=0; i<videos.length; i++) {
  var youtube = videos[i];
  // Get function
  getVideos(youtube);
}

// Get videos function
function getVideos(el){
  var img = document.createElement("img");
  // Get images
  img.setAttribute('src', 'http://i.ytimg.com/vi/'+el.id+'/hqdefault.jpg');
  // Add class to img
  img.setAttribute('class', 'thumb');
  // Make div to embed videos
  var video = document.createElement("div");
  // Remove this if you like
  video.setAttribute("class","video_here");  
  // Insert tags
  el.appendChild(img);
  el.appendChild(video);
  // On click get video
  el.addEventListener('click',function(){ 
    var iframe = document.createElement("iframe");
    iframe.setAttribute('class','youtube_video');
    iframe.setAttribute('src','https://www.youtube.com/embed/'+
    this.id +'?autoplay=1&autohide=1&border=0&wmode=opaque&enablejsapi=1'); 
    // Remplace img for video
    this.parentNode.replaceChild(iframe, this);
  },false);  
}


            
          
!
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