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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <div id="loading">
	<p>Loading <span id="loadText">0%</span></p>
	<div id="progressBar"><span></span></div>
	<img src="http://kurokoroll.com/images/loading.svg">
</div>
<div id="container">
	<div class="contentWrap" id="image1">
		<div class="content">
			<h1>nature</h1>
			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla posuere magna mi, ut interdum mauris facilisis non. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur a dolor feugiat, pellentesque tellus sed, maximus massa. Nulla sagittis condimentum eros, eget ornare nulla scelerisque et.</p>
		</div>
	</div>
	<div class="contentWrap" id="image2">
		<div class="content">
			<h1>flower</h1>
			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla posuere magna mi, ut interdum mauris facilisis non. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur a dolor feugiat, pellentesque tellus sed, maximus massa. Nulla sagittis condimentum eros, eget ornare nulla scelerisque et.</p>
		</div>
	</div>
	<div class="contentWrap" id="image3">
		<div class="content">
			<h1>tree</h1>
			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla posuere magna mi, ut interdum mauris facilisis non. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur a dolor feugiat, pellentesque tellus sed, maximus massa. Nulla sagittis condimentum eros, eget ornare nulla scelerisque et.</p>
		</div>
	</div>
	<div class="contentWrap" id="image4">
		<div class="content">
			<h1>bird</h1>
			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla posuere magna mi, ut interdum mauris facilisis non. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur a dolor feugiat, pellentesque tellus sed, maximus massa. Nulla sagittis condimentum eros, eget ornare nulla scelerisque et.</p>
		</div>
	</div>
	<div class="contentWrap" id="image5">
		<div class="content">
			<h1>sea</h1>
			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla posuere magna mi, ut interdum mauris facilisis non. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur a dolor feugiat, pellentesque tellus sed, maximus massa. Nulla sagittis condimentum eros, eget ornare nulla scelerisque et.</p>
		</div>
	</div>
	<div class="contentWrap" id="image6">
		<div class="content">
			<h1>mountain</h1>
			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla posuere magna mi, ut interdum mauris facilisis non. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur a dolor feugiat, pellentesque tellus sed, maximus massa. Nulla sagittis condimentum eros, eget ornare nulla scelerisque et.</p>
		</div>
	</div>
</div>
              
            
!

CSS

              
                body{
  line-height: 1.75;
}
#loading{
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,1);
  display: flex;
  justify-content: center;
  z-index: 10;
  transition: .3s;
  opacity: 1;
  text-align: center;
}
#loading p{
  color: white;
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%);
}
#loading.finish{
  opacity: 0;
}
#progressBar{
  background: gray;
  width: 300px;
  height: 8px;
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%);
}
#progressBar span{
  content: '';
  width: 0%;
  height: 100%;
  background: white;
  position: absolute;
  top: 0;
  left: 0;
}
#container{
  width: 100vw;
}
.contentWrap{
  position: relative;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}
.content{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 62%;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 20px rgba(0,0,0,.8);
}
.content h1{
  font-family: Arial;
  font-size: 4rem;
  font-weight: bold;
  margin-bottom: 5vw;
}
#image1{
  background: url(http://kurokoroll.com/images/image1.jpg) center center;
  background-size: cover;
}
#image2{
  background: url(http://kurokoroll.com/images/image2.jpg) center center;
  background-size: cover;
}
#image3{
  background: url(http://kurokoroll.com/images/image3.jpg) center center;
  background-size: cover;
}
#image4{
  background: url(http://kurokoroll.com/images/image4.jpg) center center;
  background-size: cover;
}
#image5{
  background: url(http://kurokoroll.com/images/image5.jpg) center center;
  background-size: cover;
}
#image6{
  background: url(http://kurokoroll.com/images/image6.jpg) center center;
  background-size: cover;
}
              
            
!

JS

              
                (function() {
  const loadingCotent = document.getElementById('loading'); //ローディングのコンテンツを変数に格納
  //画像を配列に入れる
  const images = [
    'http://kurokoroll.com/images/image1.jpg',
    'http://kurokoroll.com/images/image2.jpg',
    'http://kurokoroll.com/images/image3.jpg',
    'http://kurokoroll.com/images/image4.jpg',
    'http://kurokoroll.com/images/image5.jpg',
    'http://kurokoroll.com/images/image6.jpg'
  ];
  let count = 0; //カウント用の変数

	//画像の数だけ繰り返し行う
  for (var i = 0; i < images.length; i++) {
    let image = new Image(); //新たなイメージ要素(インスタンス)をつくる
    image.src = images[i]; //画像のパスを指定

    //画像の読み込みが完了した時の処理
    image.addEventListener('load', function(){
      count++; //画像1つ読み込みに対してカウント1増える
      let percent = Math.round(count/images.length*100)+'%'; //繰り返しの数/画像の数の割合をだし、四捨五入する
      document.getElementById('loadText').innerHTML = percent; //HTMLにパーセントを出力する
      document.querySelector('#progressBar span').style.width = percent; //プログレスバーにも割合を指定する
			//全ての画像が読み込まれたら、ローディングを透過する
      if(images.length <= count){
        loadingCotent.classList.add('finish');
      }
    });
  }
	
	//トランジションが終了したら、ローディングを消す
  loadingCotent.addEventListener('transitionend', function(){
      document.getElementsByTagName('body')[0].removeChild(loadingCotent);
  });
})();
              
            
!
999px

Console