作成してから時間が立ってだいぶ忘れてきているのですぐに思い出せるように残しておく
1:ページローダーの実装(Rails)
まず初めにPace.jsをコチラから手に入れます
https://raw.githubusercontent.com/HubSpot/pace/v1.0.0/pace.min.js
pace.jsを以下のように配置

SCSSの記述
loader.scssを以下のように記述します
@import 'variables';
@import 'mixin';
@import "base";
.pace-done #global-container {
// ゆっくりとコンテンツを表示
transition: opacity 1s;
height: 100%!important;
opacity: 1 !important;
}
#global-container {
// 画面が更新されている間はコンテンツを非表示
opacity: 0;
}
.pace {
z-index: 2000;
// 画面を中央にするための設定(bottomまで)
position: fixed;
margin: auto;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100px;
height: 100px;
}
.pace .pace-progress {
transform: none !important;
text-align: center;
}
.pace .pace-progress:after {
content: attr(data-progress-text);
display: inline-block;
font-weight: 100;
font-size: 2em;
font-family: "Helvetica Neue", "Yu Gothic", sans-serif;
color: $cSubTitle;
}
.pace.pace-inactive {
display: none;
}
.pace-progress-inner {
width: 40px;
height: 40px;
background-color: $cWineRed;
// 中央揃えにする
margin: 0 auto;
@include animation(
$name: sk-rotateplane,
$duration: 1.2s,
$iteration-count: infinite,
$timing-function: ease-in-out
);
}
@keyframes sk-rotateplane {
0% {
transform: perspective(120px) rotateX(0deg) rotateY(0deg);
}
50% {
transform: perspective(120px) rotateX(-180deg) rotateY(0deg);
}
100% {
transform: perspective(120px) rotateX(-180deg) rotateY(-180deg);
}
}
application.jsを以下のように記述します

読み込む順番が重要なので注意
