Hla mus rau cov ntsiab lus tseem ceeb Hla mus rau docs navigation
in English

Spinners

Qhia txog lub xeev thauj khoom ntawm ib feem lossis nplooj ntawv nrog Bootstrap spinners, ua tiav nrog HTML, CSS, thiab tsis muaj JavaScript.

Txog

Bootstrap "spinners" tuaj yeem siv los qhia txog lub xeev thauj khoom hauv koj cov haujlwm. Lawv tsuas yog tsim nrog HTML thiab CSS, txhais tau tias koj tsis tas yuav muaj JavaScript los tsim lawv. Txawm li cas los xij, koj yuav xav tau qee qhov kev cai JavaScript los hloov lawv qhov pom. Lawv cov tsos, sib dhos, thiab qhov loj me tuaj yeem hloov kho tau yooj yim nrog peb cov chav kawm siv hluav taws xob zoo.

Rau kev siv tau yooj yim, txhua lub loader ntawm no suav nrog role="status"thiab ib qho zes <span class="visually-hidden">Loading...</span>.

Cov nyhuv animation ntawm cov khoom siv no yog nyob ntawm cov prefers-reduced-motionlus nug xov xwm. Saib qhov txo qis ntawm peb cov ntaub ntawv nkag mus tau .

Ciam teb spinner

Siv cov ciam teb spinners rau lub teeb yuag qhov taw qhia.

Loading...
<div class="spinner-border" role="status">
  <span class="visually-hidden">Loading...</span>
</div>

Xim

Tus ciam teb spinner siv currentColorrau nws border-color, txhais tau tias koj tuaj yeem kho cov xim nrog cov ntawv xim siv . Koj tuaj yeem siv ib qho ntawm peb cov ntawv siv xim xim ntawm tus qauv spinner.

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
<div class="spinner-border text-primary" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-secondary" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-success" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-danger" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-warning" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-info" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-light" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-dark" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
Vim li cas ho tsis siv cov khoom siv border-colorhluav taws xob? Txhua tus ciam teb spinner qhia txog transparentciam teb tsawg kawg yog ib sab, yog li .border-{color}kev siv hluav taws xob yuav hla dhau qhov ntawd.

Loj hlob spinner

Yog tias koj tsis nyiam tus ciam teb spinner, hloov mus rau qhov loj hlob spinner. Thaum nws tsis technically spin, nws pheej pheej loj hlob!

Loading...
<div class="spinner-grow" role="status">
  <span class="visually-hidden">Loading...</span>
</div>

Ib zaug ntxiv, qhov spinner no tau tsim nrog currentColor, yog li koj tuaj yeem hloov nws cov tsos nrog cov ntawv xim xim . Ntawm no nws yog xiav, nrog rau kev txhawb nqa variants.

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
<div class="spinner-grow text-primary" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-secondary" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-success" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-danger" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-warning" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-info" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-light" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-dark" role="status">
  <span class="visually-hidden">Loading...</span>
</div>

Kev sib tw

Spinners hauv Bootstrap yog tsim nrog rems, currentColor, thiab display: inline-flex. Qhov no txhais tau hais tias lawv tuaj yeem hloov pauv tau yooj yim, hloov kho dua tshiab, thiab nrawm nrawm.

Margin

Siv cov khoom siv margin zoo li .m-5kom yooj yim sib nrug.

Loading...
<div class="spinner-border m-5" role="status">
  <span class="visually-hidden">Loading...</span>
</div>

Qhov chaw

Siv flexbox utilities , float utilities , lossis text alignment utilities los tso cov spinners raws nraim qhov koj xav tau nyob rau txhua qhov xwm txheej.

Flex

Loading...
<div class="d-flex justify-content-center">
  <div class="spinner-border" role="status">
    <span class="visually-hidden">Loading...</span>
  </div>
</div>
Loading...
<div class="d-flex align-items-center">
  <strong>Loading...</strong>
  <div class="spinner-border ms-auto" role="status" aria-hidden="true"></div>
</div>

ntab

Loading...
<div class="clearfix">
  <div class="spinner-border float-end" role="status">
    <span class="visually-hidden">Loading...</span>
  </div>
</div>

Text align

Loading...
<div class="text-center">
  <div class="spinner-border" role="status">
    <span class="visually-hidden">Loading...</span>
  </div>
</div>

Loj

Ntxiv .spinner-border-smthiab .spinner-grow-smua kom me me spinner tuaj yeem siv tau sai hauv lwm cov khoom.

Loading...
Loading...
<div class="spinner-border spinner-border-sm" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow spinner-grow-sm" role="status">
  <span class="visually-hidden">Loading...</span>
</div>

Los yog, siv kev cai CSS lossis inline styles hloov qhov ntev raws li xav tau.

Loading...
Loading...
<div class="spinner-border" style="width: 3rem; height: 3rem;" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow" style="width: 3rem; height: 3rem;" role="status">
  <span class="visually-hidden">Loading...</span>
</div>

Khawm

Siv cov spinners hauv cov nyees khawm los qhia tias qhov kev txiav txim tam sim no tab tom ua lossis ua qhov chaw. Koj tuaj yeem hloov cov ntawv tawm ntawm lub caij spinner thiab siv khawm ntawv raws li xav tau.

<button class="btn btn-primary" type="button" disabled>
  <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
  <span class="visually-hidden">Loading...</span>
</button>
<button class="btn btn-primary" type="button" disabled>
  <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
  Loading...
</button>
<button class="btn btn-primary" type="button" disabled>
  <span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
  <span class="visually-hidden">Loading...</span>
</button>
<button class="btn btn-primary" type="button" disabled>
  <span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
  Loading...
</button>

Sass

Hloov pauv

$spinner-width:           2rem;
$spinner-height:          $spinner-width;
$spinner-vertical-align:  -.125em;
$spinner-border-width:    .25em;
$spinner-animation-speed: .75s;

$spinner-width-sm:        1rem;
$spinner-height-sm:       $spinner-width-sm;
$spinner-border-width-sm: .2em;

Keyframes

Siv los tsim cov CSS animations rau peb spinners. suav nrog scss/_spinners.scss.

@keyframes spinner-border {
  to { transform: rotate(360deg) #{"/* rtl:ignore */"}; }
}
@keyframes spinner-grow {
  0% {
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: none;
  }
}