我使用jpreloader.js預加載頁面。而不是腳本動畫,我想運行我的,豐富多彩的旋轉圈......但我的CSS動畫不起作用。使用jpreloader.js旋轉css anim
我想做到這一點:http://ref.topictimes.com/videos/tech/how-to-create-a-custom-preloading-screen-full-blHZ6zCYvMM.html
我使整個預加載的小提琴,jpreloader.js附:http://jsfiddle.net/igorlaszlo/dy0snxvr/
在我檢查了,如果CSS動畫沒有因爲工作的同時jQuery的腳本,但是當我嘗試只是動畫本身,這是同樣的結果,這是行不通的:http://jsfiddle.net/igorlaszlo/n1L961dw/1/
的代碼只對CSS動畫:
HTML
<div id="overlay">
<div id="loader"></div>
</div>
CSS
#overlay {
position:fixed;
width:100%;
height:100%;
top:0;
left:0;
z-index:98;
background: #303636;
}
@-webkit-keyframes spin {
0% {
-webkit-transform:rotate(0deg);
-moz-transform:rotate(0deg);
-ms-transform:rotate(0deg);
transform:rotate(0deg);
}
100% {
-webkit-transform:rotate(360deg);
-moz-transform:rotate(360deg);
-ms-transform:rotate(360deg);
transform:rotate(360deg);
}
}
@-moz-keyframes spin {
0% {
-webkit-transform:rotate(0deg);
-moz-transform:rotate(0deg);
-ms-transform:rotate(0deg);
transform:rotate(0deg);
}
100% {
-webkit-transform:rotate(360deg);
-moz-transform:rotate(360deg);
-ms-transform:rotate(360deg);
transform:rotate(360deg);
}
}
@keyframes spin {
0% {
-webkit-transform:rotate(0deg);
-moz-transform:rotate(0deg);
-ms-transform:rotate(0deg);
transform:rotate(0deg);
}
100% {
-webkit-transform:rotate(360deg);
-moz-transform:rotate(360deg);
-ms-transform:rotate(360deg);
transform:rotate(360deg);
}
}
#loader {
display:block;
position:relative;
left:50%;
top:50%;
width:150px;
height:150px;
margin:-75px 0 0 -75px;
border:3px solid transparent;
border-top-color:#3498db;
-webkit-border-radius:50%;
border-radius:50%;
-webkit-animation:spin 2% linear infinite;
-moz-animation:spin 2% linear infinite;
animation:spin 2% linear infinite;
z-index:100;
}
#loader:before {
content:"";
position:absolute;
top:5px;
left:5px;
right:5px;
bottom:5px;
border:3px solid transparent;
border-top-color:#e74c3c;
-webkit-border-radius:50%;
border-radius:50%;
-webkit-animation:spin 3% linear infinite;
-moz-animation:spin 3% linear infinite;
animation:spin 3% linear infinite;
}
#loader:after {
content:"";
position:absolute;
top:15px;
left:15px;
right:15px;
bottom:15px;
border:3px solid transparent;
border-top-color:#f9c922;
-webkit-border-radius:50%;
border-radius:50%;
-webkit-animation:spin 1.5% linear infinite;
-moz-animation:spin 1.5% linear infinite;
animation:spin 1.5% linear infinite;
}
什麼是錯我的CSS動畫?
幹得好!儘管我一次一行地檢查了數百次的代碼,但我的眼睛很累,整整一天我都在電腦前面......非常感謝! – 2015-01-20 20:11:09
@IgorLaszlo是的,我們都在那裏,這麼小的代碼將代碼打碎。無論如何,很高興幫助! – RGLSV 2015-01-20 20:14:32