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 class="container">
  <div class="box js-fadeUp">
    <img
      src="https://junpei-sugiyama.com/wp-content/uploads/2021/01/dog01.jpg"
      alt=""
    />
  </div>
  <!-- /.box js-fadeUp -->
  <div class="box js-fadeLeft">
    <img
      src="https://junpei-sugiyama.com/wp-content/uploads/2021/01/dog02.jpg"
      alt=""
    />
  </div>
  <!-- /.box js-fadeUp -->
  <div class="box js-fadeRight">
    <img
      src="https://junpei-sugiyama.com/wp-content/uploads/2021/01/dog03.jpg"
      alt=""
    />
  </div>
  <!-- /.box js-fadeUp -->
  <p class="js-color">色が変わります</p>
</div>
              
            
!

CSS

              
                /* フェードイン(初期値) */
.js-fadeUp {
  opacity: 0; /* 最初は非表示 */
  transform: translateY(30px); /* 下に30pxの位置から */
  transition: opacity .8s, transform .8s; /* 透過率と縦方向の移動を0.8秒 */
}
.js-fadeLeft {
  opacity: 0; /* 最初は非表示 */
  transform: translateX(-30px); /* 下に30pxの位置から */
  transition: opacity .8s, transform .8s; /* 透過率と縦方向の移動を0.8秒 */
}
.js-fadeRight {
  opacity: 0; /* 最初は非表示 */
  transform: translateX(30px); /* 下に30pxの位置から */
  transition: opacity .8s, transform .8s; /* 透過率と縦方向の移動を0.8秒 */
}
/* フォントカラー(初期値) */
.js-color {
  color: blue; /* 最初は青色 */
  font-size: 15px; /* 最初は15px */
  transition: color .8s, font-size .8s; /* 色の変化を0.8秒かける */
}
/* フェードイン(スクロールした後) */
.js-fadeUp.is-inview {
  opacity: 1; /* 表示領域に入ったら表示 */
  transform: translateY(0); /* 30px上に移動する */
  transition-delay: .5s; /* フェード開始を0.5秒遅らせる */
}
.js-fadeLeft.is-inview {
  opacity: 1; /* 表示領域に入ったら表示 */
  transform: translateX(0); /* 30px上に移動する */
  transition-delay: .5s; /* フェード開始を0.5秒遅らせる */
}
.js-fadeRight.is-inview {
  opacity: 1; /* 表示領域に入ったら表示 */
  transform: translateX(0); /* 30px上に移動する */
  transition-delay: .5s; /* フェード開始を0.5秒遅らせる */
}
/* フォントカラー変更(スクロールした後) */
.js-color.is-inview {
  color: green; /* 表示領域に入ったら色を変える */
  font-size: 25px; /* 表示領域に入ったら25px */
  transition-delay: .5s; /* 開始を0.5秒遅らせる */
}

/* レイアウトのためのcss */
.container {
  margin-left: auto;
  margin-right: auto;
  max-width: 200px;
  padding-left: 2.4rem;
  padding-right: 2.4rem;
  width: 100%;
}
.box {
  margin-bottom: 400px;
  margin-top: 400px;
}
.box img {
  height: auto;
  width: 100%;
}
p {
  font-weight: 700;
  margin-bottom: 300px;
  margin-top: 300px;
  text-align: center;
}
              
            
!

JS

              
                // スクロールして表示領域に入ったらclass付与
$(function () {
  $(".js-fadeUp").on("inview", function () {
    $(this).addClass("is-inview");
  });
  $(".js-fadeLeft").on("inview", function () {
    $(this).addClass("is-inview");
  });
  $(".js-fadeRight").on("inview", function () {
    $(this).addClass("is-inview");
  });
  $(".js-color").on("inview", function () {
    $(this).addClass("is-inview");
  });
});
              
            
!
999px

Console