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

              
                <!-- PhotoSwipe -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/5.4.2/umd/photoswipe.umd.min.js" integrity="sha512-xH3c1Jh7FbAehFlrbmiFLL7fm2YxZRXtRJ0O9Kc+RkCW5VLkLeARPe8RwgCfzYt4N1JRqzxZtBMgsJzLehA4Tw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/5.4.2/umd/photoswipe-lightbox.umd.min.js" integrity="sha512-OB04yghyy2BT/S1t5HihjY4Jw9Us/5Fw1p5Jw41DIx71Kx+G4SjiPpd3n2ecsYAp7gJL0saH0J6k5elzVHp2+Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/5.4.2/photoswipe.min.css" integrity="sha512-LFWtdAXHQuwUGH9cImO9blA3a3GfQNkpF2uRlhaOpSbDevNyK1rmAjs13mtpjvWyi+flP7zYWboqY+8Mkd42xA==" crossorigin="anonymous" referrerpolicy="no-referrer" />

<!-- CSS -->
<style  type="text/css">
#gallery {
  width: 95%;
  margin: 1em auto; /* 上下,左右 */
  display: flex;/* 親要素 flex container */
  flex-flow: wrap;/* 折り返し */
}
#gallery img {
  width: 100%;
  height: auto;
  border: none;
  max-width: 310px;/* サイズ調整 */
  margin: 1em 0;
  padding: 8px; /* 写真外枠 */
  background: #fff;
  box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.7);
}
#gallery p {
  flex: 270px;/* 子要素 flex Item */
}
.pic-r1 {
  z-index: 2;
  transform: rotate(-10deg);
}
.pic-r2 {
  z-index: 5;
  transform: rotate(15deg);
}
.pic-r3 {
  z-index: 3;
  transform: rotate(5deg);
}
.pic-r4 {
  z-index: 5;
  transform: rotate(-3deg);
}
.pic-r5 {
  z-index: 5;
  animation: animation-1 6s infinite ease 1s both;
}
@keyframes animation-1 {
  0% {
    transform: rotate(8deg);
  }
  50% {
    transform: rotate(-15deg);
  }
  100% {
    transform: rotate(8deg);
  }
}
</style>

<!-- 画像挿入 -->
<center>
<div  id="gallery">
<p  class="pic-r1">
<a  href="https://livedoor.blogimg.jp/hakumo13-twk069wv/imgs/8/a/8ad9ca5b.jpg" data-pswp-width="" data-pswp-height="">
<img  src="https://livedoor.blogimg.jp/hakumo13-twk069wv/imgs/8/a/8ad9ca5b.jpg" style="pointer-events: none">
</a>
</p>

<p  class="pic-r2">
<a  href="https://livedoor.blogimg.jp/hakumo13-twk069wv/imgs/f/9/f9d68860.jpg" data-pswp-width="" data-pswp-height="">
<img  src="https://livedoor.blogimg.jp/hakumo13-twk069wv/imgs/f/9/f9d68860.jpg" style="pointer-events: none">
</a>
</p>

<p  class="pic-r3">
<a  href="https://livedoor.blogimg.jp/hakumo13-twk069wv/imgs/1/e/1e245521.png" data-pswp-width="" data-pswp-height="">
<img  src="https://livedoor.blogimg.jp/hakumo13-twk069wv/imgs/1/e/1e245521.png" style="pointer-events: none">
</a>
</p>
</div><!-- gallery -->
</center>

<!-- PhotoSwipe -->
<script type="text/javascript">
var lightbox = new PhotoSwipeLightbox({
        gallery: '#gallery',
        children: 'a',
        pswpModule: PhotoSwipe
});
lightbox.init();
</script>

<!-- 画像サイズを取得して属性に挿入 -->
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function () {
    const galleries = gallery.querySelectorAll('a');
    galleries.forEach((el) => {
        loadImage(el.href).then(img => {
            el.setAttribute('data-pswp-width', img.naturalWidth);
            el.setAttribute('data-pswp-height', img.naturalHeight);
            el.firstElementChild.removeAttribute('style');
        });
    });
});

function loadImage(src) {
    return new Promise((resolve, reject) => {
        const img = new Image();
        img.onload = () => resolve(img);
        img.onerror = (e) => reject(e);
        img.src = src;
    });
}
</script>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console