Pen Settings

HTML

CSS

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

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

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.

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

              
                <p class="text-center">↓スクロール↓</p>

<div class="container"><img data-src="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s0.jpg" data-retina="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s0.jpg" data-srcset="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s0.jpg 1600w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s0-300x200.jpg 300w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s0-768x513.jpg 768w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s0-1024x684.jpg 1024w"/></div>

<div class="container"><img data-src="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s1.jpg" data-retina="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s1.jpg" data-srcset="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s1.jpg 1600w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s1-300x200.jpg 300w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s1-768x513.jpg 768w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s1-1024x684.jpg 1024w"/></div>

<div class="container"><img data-src="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s2.jpg" data-retina="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s2.jpg" data-srcset="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s2.jpg 1600w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s2-300x200.jpg 300w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s2-768x513.jpg 768w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s2-1024x684.jpg 1024w"/></div>

<div class="container"><img data-src="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s3.jpg" data-retina="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s3.jpg" data-srcset="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s3.jpg 1600w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s3-300x200.jpg 300w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s3-768x513.jpg 768w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s3-1024x684.jpg 1024w"/></div>

<div class="container"><img data-src="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s4.jpg" data-retina="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s4.jpg" data-srcset="https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s4.jpg 1600w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s4-300x200.jpg 300w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s4-768x513.jpg 768w, https://cdn.rawgit.com/hal-satoyuki/jquery_lazyload_test/master/images/s4-1024x684.jpg 1024w"/></div>
              
            
!

CSS

              
                /**
* 適当にCSS設定した
* 深い意味はない
*/
body {
  background: #f2f2f2;
}
.container {
  display: block;
  padding: 250px 64px;
  text-align: center;
}
img {
  box-sizing: border-box;
  display: inline-block;
  min-width: 100%;
  max-width: 100%;
  border: 32px solid #fff;
  transform: scale(.6);
  opacity: 0;
  transition: transform 3s ease, opacity 3s ease;
}
img.is-show {
  transform: scale(1);
  opacity: 1;
}
.text-center {
  text-align: center;
}
              
            
!

JS

              
                'use strict';
var layzr = Layzr({
    normal: 'data-src',
    retina: 'data-retina',
    srcset: 'data-srcset',threshold: -30
});

layzr.on('src:after', function (element) {
    element.classList.add('is-show');
});

document.addEventListener('DOMContentLoaded', function () {
    layzr.update().check().handlers(true);
}, false);
              
            
!
999px

Console