Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="psgal_7_1" class="psgal gallery-columns-3 gallery-size-thumbnail" itemscope itemtype="http://schema.org/ImageGallery">
  <figure class="msnry_item" itemscope itemtype="http://schema.org/ImageObject">
    <a href="https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_6539-1800x1350.jpg" itemprop="contentUrl" data-size="1800x1350" data-caption="">
      <img src=https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_6539-300x225.jpg itemprop="thumbnail" alt="" />
    </a>
    <figcaption class="photoswipe-gallery-caption"></figcaption>
  </figure>

  <figure class="msnry_item" itemscope itemtype="http://schema.org/ImageObject">
    <a href="https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_6411-1800x2400.jpg" itemprop="contentUrl" data-size="1800x2400" data-caption="Hello!">
      <img src=https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_6411-225x300.jpg itemprop="thumbnail" alt="" />
    </a>
    <figcaption class="photoswipe-gallery-caption">Hello!</figcaption>
  </figure>

  <figure class="msnry_item" itemscope itemtype="http://schema.org/ImageObject">
    <a href="https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_5323-1800x1350.jpg" itemprop="contentUrl" data-size="1800x1350" data-caption="">
      <img src=https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_5323-300x225.jpg itemprop="thumbnail" alt="" />
    </a>
    <figcaption class="photoswipe-gallery-caption"></figcaption>
  </figure>

  <figure class="msnry_item" itemscope itemtype="http://schema.org/ImageObject">
    <a href="https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4783-1800x1002.jpg" itemprop="contentUrl" data-size="1800x1002" data-caption="">
      <img src=https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4783-300x167.jpg itemprop="thumbnail" alt="" />
    </a>
    <figcaption class="photoswipe-gallery-caption"></figcaption>
  </figure>

  <figure class="msnry_item" itemscope itemtype="http://schema.org/ImageObject">
    <a href="https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4705-1800x1205.jpg" itemprop="contentUrl" data-size="1800x1205" data-caption="Here is a long caption. It's way too long. ">
      <img src=https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4705-300x201.jpg itemprop="thumbnail" alt="" />
    </a>
    <figcaption class="photoswipe-gallery-caption">Here is a long caption. It's way too long. </figcaption>
  </figure>

  <figure class="msnry_item" itemscope itemtype="http://schema.org/ImageObject">
    <a href="https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4704-1800x1205.jpg" itemprop="contentUrl" data-size="1800x1205" data-caption="">
      <img src=https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4704-300x201.jpg itemprop="thumbnail" alt="" />
    </a>
    <figcaption class="photoswipe-gallery-caption"></figcaption>
  </figure>

  <figure class="msnry_item" itemscope itemtype="http://schema.org/ImageObject">
    <a href="https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4371-1800x1350.jpg" itemprop="contentUrl" data-size="1800x1350" data-caption="">
      <img src=https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4371-300x225.jpg itemprop="thumbnail" alt="" />
    </a>
    <figcaption class="photoswipe-gallery-caption"></figcaption>
  </figure>

  <figure class="msnry_item" itemscope itemtype="http://schema.org/ImageObject">
    <a href="https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4547-1800x1350.jpg" itemprop="contentUrl" data-size="1800x1350" data-caption="">
      <img src=https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4547-300x225.jpg itemprop="thumbnail" alt="" />
    </a>
    <figcaption class="photoswipe-gallery-caption"></figcaption>
  </figure>

  <figure class="msnry_item" itemscope itemtype="http://schema.org/ImageObject">
    <a href="https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4657-1800x1800.jpg" itemprop="contentUrl" data-size="1800x1800" data-caption="">
      <img src=https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4657-300x300.jpg itemprop="thumbnail" alt="" />
    </a>
    <figcaption class="photoswipe-gallery-caption"></figcaption>
  </figure>

  <figure class="msnry_item" itemscope itemtype="http://schema.org/ImageObject">
    <a href="https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4649-1800x1350.jpg" itemprop="contentUrl" data-size="1800x1350" data-caption="">
      <img src=https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4649-300x225.jpg itemprop="thumbnail" alt="" />
    </a>
    <figcaption class="photoswipe-gallery-caption"></figcaption>
  </figure>

  <figure class="msnry_item" itemscope itemtype="http://schema.org/ImageObject">
    <a href="https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4654-1800x1800.jpg" itemprop="contentUrl" data-size="1800x1800" data-caption="">
      <img src=https://plugins.thriveweb.com.au/wp-content/uploads/2017/06/IMG_4654-300x300.jpg itemprop="thumbnail" alt="" />
    </a>
    <figcaption class="photoswipe-gallery-caption"></figcaption>
  </figure>
</div>
<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

  <!-- Background of PhotoSwipe.
			         Its a separate element, as animating opacity is faster than rgba(). -->
  <div class="pswp__bg"></div>

  <!-- Slides wrapper with overflow:hidden. -->
  <div class="pswp__scroll-wrap">

    <!-- Container that holds slides.
			                PhotoSwipe keeps only 3 slides in DOM to save memory. -->
    <div class="pswp__container">
      <!-- dont modify these 3 pswp__item elements, data is added later on -->
      <div class="pswp__item"></div>
      <div class="pswp__item"></div>
      <div class="pswp__item"></div>
    </div>

    <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
    <div class="pswp__ui pswp__ui--hidden">

      <div class="pswp__top-bar">

        <!--  Controls are self-explanatory. Order can be changed. -->

        <div class="pswp__counter"></div>

        <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

        <button class="pswp__button pswp__button--share" title="Share"></button>

        <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

        <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

        <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
        <!-- element will get class pswp__preloader--active when preloader is running -->
        <div class="pswp__preloader">
          <div class="pswp__preloader__icn">
            <div class="pswp__preloader__cut">
              <div class="pswp__preloader__donut"></div>
            </div>
          </div>
        </div>
      </div>

      <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
        <div class="pswp__share-tooltip"></div>
      </div>

      <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
			            </button>

      <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
			            </button>

      <div class="pswp__caption">
        <div class="pswp__caption__center"></div>
      </div>

    </div>
              
            
!

CSS

              
                /* PhotoSwipe Plugin */
.psgal {
  margin: auto;
  padding-bottom: 40px;

  -webkit-transition: all 0.4s ease;
  -moz-transition: all 0.4s ease;
  -o-transition: all 0.4s ease;
  transition: all 0.4s ease;

  opacity: 0.1;
}

.psgal.photoswipe_showme {
  opacity: 1;
}

.psgal figure {
  float: left;

  text-align: center;
  width: 150px;

  padding: 5px;
  margin: 0px;
  box-sizing: border-box;
}
.psgal a {
  display: block;
}

.psgal img {
  margin: auto;
  max-width: 100%;
  width: auto;
  height: auto;
  border: 0;
}
.psgal figure figcaption {
  font-size: 13px;
}

.msnry {
  margin: auto;
}
.pswp__caption__center {
  text-align: center;
}

              
            
!

JS

              
                var container_7_1 = document.querySelector("#psgal_7_1");
var msnry;

// initialize  after all images have loaded
imagesLoaded(container_7_1, function() {
  // initialize Masonry after all images have loaded
  new Masonry(container_7_1, {
    // options...
    itemSelector: ".msnry_item",
    //columnWidth: 150,
    isFitWidth: true
  });

  container_7_1.className += " photoswipe_showme";
});
var totalWidth = 0;
var totalHeight = 0;


$(".psgal figure img").each(function( index ) {
  
      totalWidth = $(this).clientWidth;
        totalHeight = $(this).clientHeight;

  //$(this).parent().attr("data-size",totalWidth +"x"+totalHeight)
});

//alert(totalWidth);
              
            
!
999px

Console