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

              
                <!-- 
썸네일 만들때 기본형태 구현
@ahcher Dstyle(dstyle0210@gmail.com)
-->

<span class="lazyImage">
  <div class="spinner"></div>
  <i><img data-src="https://pixabay.com/static/uploads/photo/2015/07/15/08/18/web-845808_960_720.jpg" class="lazy" alt="샘플이미지" /></i>
  <noscript>
  <img src="https://pixabay.com/static/uploads/photo/2015/07/15/08/18/web-845808_960_720.jpg" alt="샘플이미지" />
  </noscript>
</span>
              
            
!

CSS

              
                // 썸네일 만들때의 기본형태 구현.
// 샘플 이미지의 사이즈 : 960 * 678
// 이미지가 보여질 사이즈 :  100% : 70.625%
 @originWidth:960px;
  @originHeight:678px;
  @wid:200px;
  @hei:percentage(@originHeight/@originWidth);
  @getHeipx : @wid * (@originHeight/@originWidth);
.lazyImage{
  display:inline-block;position:relative;min-width:@wid;overflow:hidden;font-size:1px;line-height:1px;
  >i{display:inline-block;height:0;width:100%;padding-bottom:@hei;
    >img{display:none;position:absolute;top:0;left:0;width:100%;height:auto;}
  }
}
.spinner {
  display:inline-block;
  position: relative;
  margin: auto;
  box-sizing: border-box;
  background-clip: padding-box;
  width: @wid;
  height: @getHeipx;
  border-radius: @getHeipx/2;
  border: 4px solid rgba(255, 255, 255, 0.1);
  -webkit-mask: linear-gradient(rgba(0, 0, 0, 0.1), black 90%);
  transform-origin: 50% 60%;
  transform: perspective(@getHeipx) rotateX(66deg);
  animation: spinner-wiggle 1.2s infinite;
}

@keyframes spinner-wiggle {
  30% {
    transform: perspective(@getHeipx) rotateX(66deg);
  }
  40% {
    transform: perspective(@getHeipx) rotateX(65deg);
  }
  50% {
    transform: perspective(@getHeipx) rotateX(68deg);
  }
  60% {
    transform: perspective(@getHeipx) rotateX(64deg);
  }
}
.spinner:before,
.spinner:after {
  content: "";
  position: absolute;
  margin: -4px;
  box-sizing: inherit;
  width: inherit;
  height: inherit;
  border-radius: inherit;
  opacity: .05;
  border: inherit;
  border-color: transparent;
  animation: spinner-spin 1.2s cubic-bezier(0.6, 0.2, 0, 0.8) infinite, spinner-fade 1.2s linear infinite;
}

.spinner:before {
  border-top-color: #66e6ff;
}

.spinner:after {
  border-top-color: #f0db75;
  animation-delay: 0.3s;
}

@keyframes spinner-spin {
  100% {
    transform: rotate(360deg);
  }
}
@keyframes spinner-fade {
  20% {
    opacity: .1;
  }
  40% {
    opacity: 1;
  }
  60% {
    opacity: .1;
  }
}




              
            
!

JS

              
                var lazyImage = {
  ready:false,
  init:function(selecter){
    if(!this.ready){
      // 이미지 준비.
      this.images = $(((!selecter) ? ".lazy" : selecter));
      if(this.images.length<1) return;

      // 이미지에 이벤트 삽입.
      this.images.one("error",function(){
        console.log("error");
      }).one("load",function(){
        $(this).fadeIn();
      });
      this.ready = true;
    };
  },
  lazy:function(selecter){
    if(!this.ready) this.init(selecter);
    this.images.each(function(){
      $(this).attr("src" , $(this).attr("data-src") );
    });
  }
}

// 보여주기 위하여, 1초 후에 실행하도록 처리.
$(function(){
  setTimeout(function(){
    lazyImage.lazy(".lazy");  
  },3000);
});
              
            
!
999px

Console