2016-08-24 2 views
0

ウェブページのプリローダーで作業していますが、アニメーションを停止する方法がわかりません。そのため、javascriptはプリローダーを消してしまいます。プリローダーの無限アニメーションを停止

基本的には状況全体を把握していて、正しく機能することができません。

$(window).load(function() { 
 
$('.cssload-whirlpool').fadeOut(); 
 
$('.preloader').delay(350).fadeOut('slow'); 
 
$('body').delay(350).css({'overflow':'visible'}); 
 
})
.preloader { 
 
    position: fixed; 
 
    top: 0; 
 
    width: 100%; 
 
    height: 100%; 
 
    background: white; 
 
    z-index: 99999; 
 
} 
 

 
.cssload-container { 
 
    position: relative; 
 
} 
 

 
.cssload-whirlpool, 
 
.cssload-whirlpool::before, 
 
.cssload-whirlpool::after { 
 
    position: absolute; 
 
    top: 50%; 
 
    left: 50%; 
 
    border: 1px solid rgb(204, 204, 204); 
 
    border-left-color: rgb(0, 0, 0); 
 
    border-radius: 974px; 
 
    -o-border-radius: 974px; 
 
    -ms-border-radius: 974px; 
 
    -webkit-border-radius: 974px; 
 
    -moz-border-radius: 974px; 
 
    
 
} 
 

 
.cssload-whirlpool { 
 
    margin: -24px 0 0 -24px; 
 
    height: 49px; 
 
    width: 49px; 
 
    animation: cssload-rotate 1150ms linear infinite; 
 
    -o-animation: cssload-rotate 1150ms linear infinite; 
 
    -ms-animation: cssload-rotate 1150ms linear infinite; 
 
    -webkit-animation: cssload-rotate 1150ms linear infinite; 
 
    -moz-animation: cssload-rotate 1150ms linear infinite; 
 
} 
 

 
.cssload-whirlpool::before { 
 
    content: ""; 
 
    margin: -22px 0 0 -22px; 
 
    height: 43px; 
 
    width: 43px; 
 
    animation: cssload-rotate 1150ms linear infinite; 
 
    -o-animation: cssload-rotate 1150ms linear infinite; 
 
    -ms-animation: cssload-rotate 1150ms linear infinite; 
 
    -webkit-animation: cssload-rotate 1150ms linear infinite; 
 
    -moz-animation: cssload-rotate 1150ms linear infinite; 
 
} 
 

 
.cssload-whirlpool::after { 
 
    content: ""; 
 
    margin: -28px 0 0 -28px; 
 
    height: 55px; 
 
    width: 55px; 
 
    animation: cssload-rotate 2300ms linear infinite; 
 
    -o-animation: cssload-rotate 2300ms linear infinite; 
 
    -ms-animation: cssload-rotate 2300ms linear infinite; 
 
    -webkit-animation: cssload-rotate 2300ms linear infinite; 
 
    -moz-animation: cssload-rotate 2300ms linear infinite; 
 
} 
 

 
@keyframes cssload-rotate { 
 
    100% { 
 
     transform: rotate(360deg); 
 
    } 
 
} 
 

 
@-o-keyframes cssload-rotate { 
 
    100% { 
 
     -o-transform: rotate(360deg); 
 
    } 
 
} 
 

 
@-ms-keyframes cssload-rotate { 
 
    100% { 
 
     -ms-transform: rotate(360deg); 
 
    } 
 
} 
 

 
@-webkit-keyframes cssload-rotate { 
 
    100% { 
 
     -webkit-transform: rotate(360deg); 
 
    } 
 
} 
 

 
@-moz-keyframes cssload-rotate { 
 
    100% { 
 
     -moz-transform: rotate(360deg); 
 
    } 
 
}
<div class="preloader"> 
 
     <div class="cssload-whirlpool"></div> 
 
</div>

ありがとう:-)任意のヘルプをappriciateだろう。

+0

含まれていない、あなたは、それをフェードアウトそれを削除し、アニメーションや他の何かを停止しようとしていますか? –

+0

.preloaderはZ-index空白ページですので、その下のWebページの内容が表示されます。それは偽のプリロードページとして機能するはずです。 – Lukas

+0

jQueryをスニペットに組み込んだ後はうまくいくようです... '$'は定義されていないので、エラーと無限のアニメーションが得られます。 –

答えて

0

あなたはこの

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 

$(window).load(function() { 
 
$('.cssload-whirlpool').fadeOut(); 
 
$('.preloader').delay(350).fadeOut('slow'); 
 
$('body').delay(350).css({'overflow':'visible'}); 
 
})
.preloader { 
 
    position: fixed; 
 
    top: 0; 
 
    width: 100%; 
 
    height: 100%; 
 
    background: white; 
 
    z-index: 99999; 
 
} 
 

 
.cssload-container { 
 
    position: relative; 
 
} 
 

 
.cssload-whirlpool, 
 
.cssload-whirlpool::before, 
 
.cssload-whirlpool::after { 
 
    position: absolute; 
 
    top: 50%; 
 
    left: 50%; 
 
    border: 1px solid rgb(204, 204, 204); 
 
    border-left-color: rgb(0, 0, 0); 
 
    border-radius: 974px; 
 
    -o-border-radius: 974px; 
 
    -ms-border-radius: 974px; 
 
    -webkit-border-radius: 974px; 
 
    -moz-border-radius: 974px; 
 
    
 
} 
 

 
.cssload-whirlpool { 
 
    margin: -24px 0 0 -24px; 
 
    height: 49px; 
 
    width: 49px; 
 
    animation: cssload-rotate 1150ms linear infinite; 
 
    -o-animation: cssload-rotate 1150ms linear infinite; 
 
    -ms-animation: cssload-rotate 1150ms linear infinite; 
 
    -webkit-animation: cssload-rotate 1150ms linear infinite; 
 
    -moz-animation: cssload-rotate 1150ms linear infinite; 
 
} 
 

 
.cssload-whirlpool::before { 
 
    content: ""; 
 
    margin: -22px 0 0 -22px; 
 
    height: 43px; 
 
    width: 43px; 
 
    animation: cssload-rotate 1150ms linear infinite; 
 
    -o-animation: cssload-rotate 1150ms linear infinite; 
 
    -ms-animation: cssload-rotate 1150ms linear infinite; 
 
    -webkit-animation: cssload-rotate 1150ms linear infinite; 
 
    -moz-animation: cssload-rotate 1150ms linear infinite; 
 
} 
 

 
.cssload-whirlpool::after { 
 
    content: ""; 
 
    margin: -28px 0 0 -28px; 
 
    height: 55px; 
 
    width: 55px; 
 
    animation: cssload-rotate 2300ms linear infinite; 
 
    -o-animation: cssload-rotate 2300ms linear infinite; 
 
    -ms-animation: cssload-rotate 2300ms linear infinite; 
 
    -webkit-animation: cssload-rotate 2300ms linear infinite; 
 
    -moz-animation: cssload-rotate 2300ms linear infinite; 
 
} 
 

 
@keyframes cssload-rotate { 
 
    100% { 
 
     transform: rotate(360deg); 
 
    } 
 
} 
 

 
@-o-keyframes cssload-rotate { 
 
    100% { 
 
     -o-transform: rotate(360deg); 
 
    } 
 
} 
 

 
@-ms-keyframes cssload-rotate { 
 
    100% { 
 
     -ms-transform: rotate(360deg); 
 
    } 
 
} 
 

 
@-webkit-keyframes cssload-rotate { 
 
    100% { 
 
     -webkit-transform: rotate(360deg); 
 
    } 
 
} 
 

 
@-moz-keyframes cssload-rotate { 
 
    100% { 
 
     -moz-transform: rotate(360deg); 
 
    } 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 
 
<div class="preloader"> 
 
     <div class="cssload-whirlpool"></div> 
 
</div>

+0

ああ私の神、はい。私はカスタムスクリプトの下でそれを持っていた。今、愚かな気分に...ありがとう、ごめんなさい。 – Lukas

0

これは愚かなことかもしれませんが、私のcodepenでjQueryを実装することによってそれを動作させました。

// StackOverflow requires code in order to link codepens! 
$(window).load(function() { 
    $('.cssload-whirlpool').fadeOut(); 
    $('.preloader').delay(350).fadeOut('slow'); 
    $('body').delay(350).css({'overflow':'visible'}); 
}) 

http://codepen.io/anon/pen/xOokwG

EDIT:それはありませんでしたが判明:)。

関連する問題