Tôi đang cố gắng để tìm một giải pháp qua trình duyệt cho hiệu ứng này, nhưng đây là tốt nhất mà tôi có thể tìm thấy:Vô tận quay hình ảnh/div (cross-browser)
Đây cũng là rất thân thiện với CPU.
Một số giải pháp javascript không qua trình duyệt sử dụng gần 50% CPU. Theo tôi, đó không phải là giải pháp cho việc sử dụng web.
Ví dụ được cung cấp hoạt động trong Chrome 17, Firefox 11 và Safari 5.1.7.
Vì vậy, câu hỏi của tôi là: Có cách nào để tạo hiệu ứng này (không có flash hoặc java tất nhiên) vì vậy nó cũng sẽ hoạt động trong Opera và IE?
EDIT:
HTML
<div id="starholder">
<div id="star"></div>
</div>
CSS
@-webkit-keyframes spin {
from { -webkit-transform: rotate(0deg); }
to { -webkit-transform: rotate(360deg); }
}
@-moz-keyframes spin {
from { -moz-transform: rotate(0deg); }
to { -moz-transform: rotate(360deg); }
}
@-ms-keyframes spin {
from { -ms-transform: rotate(0deg); }
to { -ms-transform: rotate(360deg); }
}
#starholder {
position: relative;
width: 400px;
height: 400px;
margin: 100px 0 0 100px;
}
#star {
background: url(http://3.bp.blogspot.com/__RwzDZn-SJM/RoEJcKxDs6I/AAAAAAAAAAQ/XYAyhQG2kcw/s320/hypnosis.gif) 0 0 no-repeat;
position: absolute;
top: -100px;
left: -100px;
width: 320px;
height: 320px;
-webkit-animation-name: spin;
-webkit-animation-duration: 12000ms;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
-moz-animation-name: spin;
-moz-animation-duration: 12000ms;
-moz-animation-iteration-count: infinite;
-moz-animation-timing-function: linear;
-ms-animation-name: spin;
-ms-animation-duration: 12000ms;
-ms-animation-iteration-count: infinite;
-ms-animation-timing-function: linear;
}
Đặt mã trong câu hỏi của bạn. Bạn không thể chỉ dựa vào một liên kết Fiddle. –
Nếu bạn thêm '-o-keyframes' và' -ms-keyframes', bạn sẽ nhận được một số hỗ trợ Opera (tôi không chắc chắn về số phiên bản chính xác) và hỗ trợ của IE 10, ít nhất là :) – Ryan
@minitech: Could bạn cung cấp một ví dụ xin vui lòng? –