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.

            
              <html>
  <head>
    <style>
      @import "https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.2/css/swiper.min.css";
    </style>
  </head>
  <body>
    <h1>My Photo Gallery</h1>
    <!-- Swiper -->
    <div class="swiper-container">
      <div class="swiper-wrapper">
        
        <div class="swiper-slide" id="1">
          <p>
            <img src="https://c1.staticflickr.com/2/1325/4601401297_3bc62d82bb.jpg">
          </p>
          <mark>
          <a href="https://flic.kr/p/81Boi8" target="_blank">Webb Telescope&#x27;s ISIM Structure Gets Cold-Tested</a><br />by <a href="https://www.flickr.com/photos/gsfc" target="_blank">NASA Goddard Space Flight Center</a>, on Flickr
          <a href="https://creativecommons.org/licenses/by/2.0/" target="_blank">CC License</a>
          </mark>
        </div>
        
        <div class="swiper-slide" id="2">
          <p>
            <img src="https://c1.staticflickr.com/5/4016/4616355132_3d8058db4e.jpg">
          </p>
          <mark>
          <a href="https://flic.kr/p/82W2xS" target="_blank">Oil Slick in the Gulf of Mexico May 17th View [Close Up]</a> <br />by <a href="https://www.flickr.com/photos/gsfc/" target="_blank">NASA Goddard Space Flight Center</a>, on Flickr
          <a href="https://creativecommons.org/licenses/by/2.0/" target="_blank">CC License</a>
          </mark>
        </div>
        
        <div class="swiper-slide" id="3">
          <p>
            <img src="https://c1.staticflickr.com/4/3393/4612673368_af4ec6e2f9.jpg">
          </p>
          <mark>
          <a href="https://flic.kr/p/82Ba6b" target="_blank">Ash plume from Eyjafjallajokull Volcano, Iceland May 16h View [detail]</a> <br />by <a href="https://www.flickr.com/photos/gsfc/" target="_blank">NASA Goddard Space Flight Center</a>, on Flickr
          <a href="https://creativecommons.org/licenses/by/2.0/" target="_blank">CC License</a>
          </mark>
        </div>
        
      </div>
      <!-- Add Pagination -->
      <div class="swiper-pagination"></div>
       <!-- Add Arrows -->
      <div class="swiper-button-next"></div>
      <div class="swiper-button-prev"></div>
    </div>
    
    <!-- holder for the fullscreen slider -->
    <div id="fullscreen-swiper"></div>
    <div id="fullscreen-swiper-backdrop"></div>
        
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.2/js/swiper.jquery.min.js"></script>
  </body>
</html>
            
          
!
            
              .swiper-slide {
  background: #ddf;
  min-height: 350px;
  padding-bottom: 30px;
  text-align: center;
}

.swiper-slide img {
  border: 1px solid #fff;
  cursor: pointer;
  max-width: 100%;
  max-height: 300px;
}

#fullscreen-swiper {
  display: none;
  height: 90vh;
  overflow: hidden;
  position: absolute;
  top: 5%;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10000;
}

#fullscreen-swiper .swiper-slide {
  background: none; 
}

#fullscreen-swiper .swiper-slide img {
  height: 75vh;
  max-height: 650px;
}

#fullscreen-swiper-backdrop {
  background: #000;
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  
}
#fullscreen-swiper-close {
  border: 1px solid #fff;
  color: #fff;
  cursor: pointer;
  font-size: 24px;
  padding: 1px 6px 0;
  position: absolute;
  top: 0;
  right: 15px;
  z-index: 10000;
}

.no-scroll {height: 100%; overflow: hidden}

/* 
  The styles below are optional, 
  they just make the example look better
*/
body {
  margin-top: 0; 
  font-family: Sans-Serif;
}

mark {
  background-color: #ccc;
  line-height: 20px;
  padding: 0 0.25em;
}

mark a {
  text-decoration: none;
}

#fullscreen-swiper .swiper-pagination-bullets {
  bottom: -2px;
}

#fullscreen-swiper .swiper-pagination-bullet {
  background: #fff;
  opacity: .5;
}

#fullscreen-swiper .swiper-pagination-bullet-active {
  background: #007aff;
}

            
          
!
            
              (function() {
  var swiper = new Swiper('.swiper-container', {
      pagination: '.swiper-pagination',
    	nextButton: '.swiper-button-next',
      prevButton: '.swiper-button-prev',
      slidesPerView: 2,
      centeredSlides: true,
      paginationClickable: true,
      spaceBetween: 10,
      loop: true,
  });
  
  $('.swiper-container .swiper-slide').on('click', function() {
    var slideId = $(this).attr('id');         
    openFullscreenSwiper(slideId);
  });
  
  function openFullscreenSwiper(initialSlideNumber) {
    var mainSwiperMarkup = $('.swiper-container').html(); 
    
    $('#fullscreen-swiper')
      .append(mainSwiperMarkup + "<div id='fullscreen-swiper-close'>X</div>")
      .fadeIn();
    
    var fullscreenSwiper = new Swiper('#fullscreen-swiper', {
      pagination: '.swiper-pagination',
      nextButton: '.swiper-button-next',
      prevButton: '.swiper-button-prev',
      slidesPerView: 1,
      centeredSlides: true,
      paginationClickable: true,
      spaceBetween: 10,
      loop: true,
      initialSlide: initialSlideNumber - 1,
    });      
    
    $('#fullscreen-swiper-backdrop').fadeIn();
    $('body, html').addClass('no-scroll');  

    $('#fullscreen-swiper-close').on('click', function() {
      $('#fullscreen-swiper').hide().empty();
      $('#fullscreen-swiper-backdrop').fadeOut();
      $('body, html').removeClass('no-scroll');
    });
  
  }

})();
            
          
!
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