簡體   English   中英

如何通過更改CSS的高度和寬度來制作較小的加載圓?

[英]how to make small loading circle by changing css height and width?

我有一個加載圓圈,但尺寸太大,我想減小它,但找不到解決方法。

我正在使用下面的HTML和CSS創建加載圈子。

<div style="position: absolute; top: -5px; opacity: 0.25; animation: opacity-60-25-2-13 1s linear infinite;">
    <div style="position: absolute; width: 30px; height: 10px; box-shadow: rgba(0, 0, 0, 0.0980392) 0px 0px 1px; transform-origin: left 50% 0px; transform: rotate(55deg) translate(30px, 0px); border-radius: 5px; background: rgb(0, 0, 0);"></div>
</div>

spin.js

function SpinStart()
{
    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: '50%', // Top position relative to parent
        left: '50%' // Left position relative to parent
    };
    var target = document.getElementById('spinner');
     spinner = new Spinner(opts).spin(target);
}

嘗試使用transform:scale(0.67)作為加載圓div ,它將把div縮小到原始大小。

您可以根據需要更改比例值。

div{
-webkit-transform: scale(0.67);
       -moz-transform: scale(0.67);
            transform: scale(0.67);
}

在這里演示

如果您使用的是spin.js,請嘗試更改選項值以減小Spinner的大小:

var opts = {
  lines: 10 // The number of lines to draw
, length: 9 // The length of each line
, width: 5 // The line thickness
, radius: 5 // The radius of the inner circle
, scale: 1 // Scales overall size of the spinner
, corners: 1 // Corner roundness (0..1)
, color: '#000' // #rgb or #rrggbb or array of colors
, opacity: 0.25 // Opacity of the lines
, rotate: 0 // The rotation offset
, direction: 1 // 1: clockwise, -1: counterclockwise
, speed: 1 // Rounds per second
, trail: 60 // Afterglow percentage
, fps: 20 // Frames per second when using setTimeout() as a fallback for CSS
, zIndex: 2e9 // The z-index (defaults to 2000000000)
, className: 'spinner' // The CSS class to assign to the spinner
, top: '50%' // Top position relative to parent
, left: '50%' // Left position relative to parent
, shadow: false // Whether to render a shadow
, hwaccel: false // Whether to use hardware acceleration
, position: 'absolute' // Element positioning
}
var target = document.getElementById('spin')
var spinner = new Spinner(opts).spin(target);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM