Rach gu prìomh shusbaint Air adhart gu seòladh docs
Check

Cleachd na cuir a-steach raon àbhaisteach againn airson stoidhle tar-bhrobhsair cunbhalach agus gnàthachadh togte.

Air an duilleig seo

Ro-shealladh

Cruthaich <input type="range">smachdan gnàthaichte le .form-range. Tha an t-slighe (an cùl-raon) agus an òrdag (an luach) le chèile air an stoidhleachadh gus nochdadh mar an ceudna thairis air brobhsairean. Leis nach eil ach Firefox a’ toirt taic do “lìonadh” an t-slighe aca bho thaobh clì no deas na h-òrdaig mar dhòigh air adhartas a chomharrachadh gu fradharcach, chan eil sinn a’ toirt taic dha an-dràsta.

html
<label for="customRange1" class="form-label">Example range</label>
<input type="range" class="form-range" id="customRange1">

Ciorramach

Cuir a-steach am disabledfeart boolean air cuir a-steach gus sealladh liath a thoirt dha, cuir às do thachartasan puing, agus casg a chuir air fòcas.

html
<label for="disabledRange" class="form-label">Disabled range</label>
<input type="range" class="form-range" id="disabledRange" disabled>

Min agus as àirde

Tha luachan soilleir aig cuir a-steach raon airson minagus max- 0agus 100, fa leth. Faodaidh tu luachan ùra a shònrachadh dhaibhsan a tha a’ cleachdadh an minagus maxbuadhan.

html
<label for="customRange2" class="form-label">Example range</label>
<input type="range" class="form-range" min="0" max="5" id="customRange2">

Ceumannan

Gu gnàthach, bidh raon a’ toirt a-steach “snap” gu luachan iomlan. Gus seo atharrachadh, faodaidh tu stepluach a shònrachadh. Anns an eisimpleir gu h-ìosal, bidh sinn a’ dùblachadh an àireamh de cheumannan le bhith a’ cleachdadh step="0.5".

html
<label for="customRange3" class="form-label">Example range</label>
<input type="range" class="form-range" min="0" max="5" step="0.5" id="customRange3">

Sass

Caochlaidhean

$form-range-track-width:          100%;
$form-range-track-height:         .5rem;
$form-range-track-cursor:         pointer;
$form-range-track-bg:             $gray-300;
$form-range-track-border-radius:  1rem;
$form-range-track-box-shadow:     $box-shadow-inset;

$form-range-thumb-width:                   1rem;
$form-range-thumb-height:                  $form-range-thumb-width;
$form-range-thumb-bg:                      $component-active-bg;
$form-range-thumb-border:                  0;
$form-range-thumb-border-radius:           1rem;
$form-range-thumb-box-shadow:              0 .1rem .25rem rgba($black, .1);
$form-range-thumb-focus-box-shadow:        0 0 0 1px $body-bg, $input-focus-box-shadow;
$form-range-thumb-focus-box-shadow-width:  $input-focus-width; // For focus box shadow issue in Edge
$form-range-thumb-active-bg:               tint-color($component-active-bg, 70%);
$form-range-thumb-disabled-bg:             $gray-500;
$form-range-thumb-transition:              background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;