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.

            
              <!--

  Hey! Go take a look at Matthew Bird's positively wonderful dribbble shot!
  http://dribbble.com/shots/1436240-Quote-App-Concept

-->

<div class="slider">
  <ul class="widget">
    <li>
      <img src="https://images.unsplash.com/photo-1506894728506-7cd30f73a1b2?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=ab1df9198dbc61288852c200f045be89" />
      <blockquote>
        Culture is a mass hallucination, and when you step outside the mass hallucination you see it for what it's worth.
        <credit>Terence Mckenna</credit>
      </blockquote>
    </li>
    <li>
      <img src="https://25.media.tumblr.com/ae324e7244c389e47e1095065d6969db/tumblr_n1iq25Wq701st5lhmo1_1280.jpg" />
      <blockquote>
        The pessimist complains about the wind;<br />
        the optimist expects it to change;<br />
        the realist adjusts the sails.
        <credit>William Arthur Ward</credit>
      </blockquote>
    </li>
    <li>
      <img src="https://25.media.tumblr.com/d2f4810531ede7d2ad23504b695cd229/tumblr_n1iq6fDee61st5lhmo1_1280.jpg" />
      <blockquote>
        Experience is not what happens to you;<br />
        it's what you do with what happens to you.
        <credit>Aldous Huxley</credit>
      </blockquote>
    </li>
    <li>
      <img src="https://31.media.tumblr.com/f0cb0d2bc887555434fa3afe0530e1cf/tumblr_n1ipr3bTo11st5lhmo1_1280.jpg" />
      <blockquote>
        By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest.
        <credit>Confucius</credit>
      </blockquote>
    </li>
  </ul>
  <div class="controls">
    <div class="top">
      <a href="#close"><i class="fa fa-times"></i></a>
      <a href="#share"><i class="fa fa-reply"></i></a>
    </div>
    <div class="bottom">
      <label>0 of 0</label>
      <hr />
      <div class="buttons">
        <a href="#next"><i class="fa fa-chevron-right"></i></a>
        <a href="#prev"><i class="fa fa-chevron-left"></i></a>
        <a href="#like"><i class="fa fa-thumbs-up"></i></a>
        <a href="#search"><i class="fa fa-search"></i></a>
        <a href="#comments"><i class="fa fa-comments"></i></a>
      </div>
    </div>
  </div>
</div>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Gafata);
@import url(https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css);

html
{
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, #F2F2F2, #494949);
}

body
{
  font-family: "Gafata", sans-serif;
  font-weight: normal;
  text-shadow: 0 0 1px #FFF;
  color: #FFF;
}

.slider
{
  position: relative;
  width: 600px;
  height: 450px;
  overflow: hidden;
  margin: 50px auto;
  border-radius: 15px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, .33);
}

.slider > .widget
{
  position: absolute;
  width: 99999999px;
  height: 450px;
  white-space: nowrap;
}

.slider > .widget.do-slide
{
  animation-name: do-slide;
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
  animation-duration: 1s;
  animation-timing-function: ease-out;
}

.slider > .widget.backwards-slide
{
  animation-name: do-slide;
  animation-iteration-count: 1;
  animation-fill-mode: backwards;
  animation-duration: 1s;
  animation-direction: reverse;
  animation-timing-function: ease-in;
}

.slider > .widget > li
{
  position: relative;
  float: left;
  width: 600px;
  height: 450px;
  background: #000;
  white-space: normal;
}

.slider > .widget > li, .slider > .widget > li > img
{
  width: 600px;
  height: 450px;
}

.slider > .widget > li > img { opacity: .6 }

.slider > .widget > li > blockquote
{
  position: absolute;
  z-index: 1;
  top: 25%;
  left: 50%;
  width: 420px;
  margin: 0 0 0 -210px;
  text-align: center;
  font-size: 24px;
  line-height: 28px;
}

.slider > .widget > li > blockquote > credit
{
  display: block;
  position: absolute;
  top: 130%;
  right: 7%;
  font-size: 18px;
}

.slider > .widget > li > blockquote > credit:before
{
  content: "- ";
  padding: 0 5px 0 0;
  font-size: 14px;
}

.slider > .controls
{
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.slider > .controls > .top
{
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  left: 0;
  padding: 20px;
}

.slider > .controls > .top > a
{
  display: block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  vertical-align: middle;
  text-align: center;
  text-decoration: none;
  font-size: 12px;
  color: #FFF;
  border: 2px solid #FFF;
  border-radius: 50%;
}

.slider > .controls > .top > a[href="#close"] { float: right }

.slider > .controls > .bottom
{
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 20px 25%;
  text-align: center;
}

.slider > .controls > .bottom > label
{
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 1px;
  opacity: .66;
}

.slider > .controls > .bottom > hr
{
  display: block;
  margin: 13px 0;
  height: 1px;
  background: transparent;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, .25);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.slider > .controls > .bottom > .buttons > a
{
  margin: 0 15px;
  text-decoration: none;
  font-size: 18px;
  color: #FFF;
}

.slider > .controls > .bottom > .buttons > a[href="#next"] { margin: 0; float: right }
.slider > .controls > .bottom > .buttons > a[href="#prev"] { margin: 0; float: left }

@keyframes do-slide
{
  0% { left: 0 }
  100% { left: -600px }
}
            
          
!
            
              function roll()
{
  var slider = $('.slider > .widget');
    slider.removeClass('do-slide');
  
  $('.slider > .controls > .bottom > label').html(slider.find('> li').first().attr('num') + ' of ' + slider.find('> li').size());
  
  window.sliderTimeout = setTimeout(function()
  {
    slider.addClass('do-slide');
    window.sliderTimeout = setTimeout(function()
    {
      slider.find('> li').first().appendTo(slider);
      roll();
    }, 1000);
  }, 5000);
}

$(function()
{
  $('.slider > .widget > li').each(function()
  {
    $(this).attr('num', $(this).index() + 1);
  });
  
  $('.slider a').click(function()
  {
    switch($(this).attr('href'))
    {
      case '#share':
        alert('You clicked share!\nGood for you! :)');
        break;
      case '#close':
        alert('This would trigger a widget.close() event');
        break;
      case '#like':
        alert('You clicked like!\nAwesome! :D');
        break;
      case '#search':
        alert('This would trigger a modal with a search box');
        break;
      case '#comments':
        alert('This would trigger a modal with any comments');
        break;
      case '#prev':
        window.clearTimeout(window.sliderTimeout);
        $('.slider > .widget').addClass('backwards-slide').find('> li').last().prependTo('.slider > .widget');
        window.sliderTimeout = setTimeout(function()
        {
          $('.slider > .widget').removeClass('backwards-slide');
          roll();
        }, 1000);
        break;
      case '#next':
        window.clearTimeout(window.sliderTimeout);
        $('.slider > .widget').addClass('do-slide');
        window.sliderTimeout = setTimeout(function()
        {
          $('.slider > .widget').removeClass('do-slide').find('> li').first().appendTo('.slider > .widget');
          roll();
        }, 1000);
        break;
    }
    return false;
  });
  
  roll();
});
            
          
!
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