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

              
                <head>
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <!--==============レイアウトを制御する独自のCSSを読み込み===============-->
  <link rel="stylesheet" type="text/css" href="https://assets.codepen.io/6329135/reset.css">
</head>

<body>

  <h1>WEB先案内について</h1>
  <p class="lead">使用したライブラリ:<br>・カウントアップダウン<br><a href="https://github.com/LadyBiosphere/animated-counter" target="_blank">https://github.com/LadyBiosphere/animated-counter</a><br>・画面に入ったらカウントアップ・ダウンをスタートするきっかけ<br><a href="https://github.com/protonet/jquery.inview" target="_blank">https://github.com/protonet/jquery.inview</a></p>

  <div id="box1" class="box">
    <h2>習慣</h2>
    <p>妄想<br><span class="count-up count-size">9999</span>回</p>
    <p>ジム<br>週<span class="count-up count-size">5</span>回</p>
    <p>コーヒー<br><span class="count-up count-size">2</span>回/日</p>
    <h2>実績</h2>
    <p>WordPress修復実績<br><span class="count-up count-size">300</span>サイト</p>
    <p>ココナラ実績<br><span class="count-up count-size">378</span>件</p>
    <!--/box-->
  </div>

  <div id="box2" class="box">
    <h2>ココナラ検索</h2>
    <p>検索ワード『<a href="https://coconala.com/search?keyword=WordPress%E3%80%80%E4%B8%8D%E5%85%B7%E5%90%88" target="_blank" rel="noopener noreferrer">WordPress 不具合</a>』<br>〜おすすめ順〜<br><span class="count-down count-size">1</span>位<br>だったことがあります</p>
    <!--/box-->
  </div>

  <div id="box3" class="box">
    <h2>スキル</h2>
    <p>1級電気施工管理技士<br><span class="count-up count-size">10</span>年</p>
    <p>WordPress<br><span class="count-up count-size">4</span>年</p>
    <p>WEBエンジニア<br><span class="count-up count-size">4</span>年</p>
    <!--/box-->
  </div>

  <div id="box4" class="box">
    <h2>触ったことがある<br>言語・フレームワーク</h2>
    <p>HTML<br><span class="count-up count-size">15</span>年</p>
    <p>CSS<br><span class="count-up count-size">15</span>年</p>
    <p>Bootstrap<br><span class="count-up count-size">4</span>年</p>
    <p>jQuery<br><span class="count-up count-size">4</span>年</p>
    <p>PHP<br><span class="count-up count-size">4</span>年</p>
    <p>C#<br><span class="count-up count-size">2</span>年</p>
    <p>Sass<br><span class="count-up count-size">1</span>年未満</p>
    <p>Vue.js<br><span class="count-up count-size">1</span>年未満</p>
    <p>Nuxt.js<br><span class="count-up count-size">1</span>年未満</p>
    <p>Ruby, Ruby on Rails<br><span class="count-up count-size">1</span>年未満</p>
    <!--/box-->
  </div>
  <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/protonet-jquery.inview/1.1.2/jquery.inview.min.js"></script>

</body>
              
            
!

CSS

              
                @charset "utf-8";

/*========= レイアウトのためのCSS ===============*/

body {
  vertical-align: middle;
  text-align: center;
  z-index: 1;
  width: 100%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-image: linear-gradient(
    76.5deg,
    rgba(129, 252, 255, 1) 0.4%,
    rgba(255, 175, 207, 1) 49.8%,
    rgba(255, 208, 153, 1) 98.6%
  );
  object-fit: cover;
}

h1,
h2 {
  text-align: center;
  text-transform: uppercase;
  font-size: 2rem;
  padding-top: 30px;
  color: #666;
}

.lead {
  padding: 20px;
  text-align: center;
}

a {
  color: #666;
  font-weight: bold;
}

.box {
  max-width: 500px;
  width: 100%;
  margin: 10vh auto;
  padding: 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 10px 10px 5px -2px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-radius: 10px;
}

.box p,
p {
  color: #666;
  margin: 50px auto;
}

.count-size {
  font-size: 3rem;
  font-weight: bold;
  color: #ff7c00;
  background: -webkit-linear-gradient(
    top,
    #ffb76b 0%,
    #ffa73d 50%,
    #ff7c00 51%,
    #ff7f04 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

              
            
!

JS

              
                // https://github.com/LadyBiosphere/animated-counterの改変
$("#box1").on("inview", function (event, isInView) {
  if (isInView) {
    //要素が見えたときに実行する処理
    $("#box1 .count-up").each(function () {
      $(this)
        .prop("Counter", 0)
        .animate(
          {
            //0からカウントアップ
            Counter: $(this).text()
          },
          {
            // スピードやアニメーションの設定
            duration: 2000, //数字が大きいほど変化のスピードが遅くなる。2000=2秒
            easing: "swing", //動きの種類。他にもlinearなど設定可能
            step: function (now) {
              $(this).text(Math.ceil(now));
            }
          }
        );
    });
  }
});

$("#box2").on("inview", function (event, isInView) {
  if (isInView) {
    //要素が見えたときに実行する処理
    $("#box2 .count-down").each(function () {
      $(this)
        .prop("Counter", 100)
        .animate(
          {
            //10からカウントダウン
            Counter: $(this).text()
          },
          {
            // スピードやアニメーションの設定
            duration: 2000, //数字が大きいほど変化のスピードが遅くなる。2000=2秒
            easing: "swing", //動きの種類。他にもlinearなど設定可能
            step: function (now) {
              $(this).text(Math.ceil(now));
            }
          }
        );
    });
  }
});

$("#box3").on("inview", function (event, isInView) {
  if (isInView) {
    //要素が見えたときに実行する処理
    $("#box3 .count-up").each(function () {
      $(this)
        .prop("Counter", 0)
        .animate(
          {
            //0からカウントアップ
            Counter: $(this).text()
          },
          {
            // スピードやアニメーションの設定
            duration: 200, //数字が大きいほど変化のスピードが遅くなる。2000=2秒
            easing: "swing", //動きの種類。他にもlinearなど設定可能
            step: function (now) {
              $(this).text(Math.ceil(now));
            }
          }
        );
    });
  }
});

$("#box4").on("inview", function (event, isInView) {
  if (isInView) {
    //要素が見えたときに実行する処理
    $("#box4 .count-up").each(function () {
      $(this)
        .prop("Counter", 0)
        .animate(
          {
            //0からカウントアップ
            Counter: $(this).text()
          },
          {
            // スピードやアニメーションの設定
            duration: 5000, //数字が大きいほど変化のスピードが遅くなる。5000=5秒
            easing: "swing", //動きの種類。他にもlinearなど設定可能
            step: function (now) {
              $(this).text(Math.ceil(now));
            }
          }
        );
    });
  }
});

              
            
!
999px

Console