0
我已經嘗試了兩個css動畫旋鈕和JavaScript動畫旋轉器,直到$(window).load()激發。但是,由於我的document.ready函數中密集的js,動畫不斷中斷。我目前的實施如下:如何使頁面加載微調器順利旋轉?
<div id="spinner"></div>
<script>
$("#spinner").css("top",$(window).height()/2-50);
$("#spinner").css("left",$(window).width()/2-50);
var opts = {
lines: 13, // The number of lines to draw
length: 20, // The length of each line
width: 10, // The line thickness
radius: 30, // The radius of the inner circle
corners: 1, // Corner roundness (0..1)
rotate: 0, // The rotation offset
direction: 1, // 1: clockwise, -1: counterclockwise
color: '#000', // #rgb or #rrggbb or array of colors
speed: 1, // Rounds per second
trail: 60, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false, // Whether to use hardware acceleration
className: 'spinner', // The CSS class to assign to the spinner
zIndex: 2e9, // The z-index (defaults to 2000000000)
top: 'auto', // Top position relative to parent in px
left: 'auto' // Left position relative to parent in px
};
$("#spinner").css("display","inline-block");
target = document.getElementById('spinner');
spinner = new Spinner(opts).spin(target);
</script>
我有一個類似的問題,如果微調使用CSS動畫。我也嘗試了一個動畫gif圖像來達到同樣的效果。最後,就我所知,使用webworker將無濟於事,因爲無法從webworker訪問主線程的DOM。有什麼建議麼?