Urmachiykuna
Contextual llanthukunata tikray t'inkikuna listakuna rikuchinapaq chaymanta aswan Bootstrap urayk'aq plugin kaqwan.
Urmachiykuna tikranapaq kanku, contextual llanthukuna t'inkikuna listakuna rikuchinapaq chaymanta aswan. Paykunaqa ruwasqa kanku interactivo kaqwan chaymanta Bootstrap urayk'aq JavaScript plugin kaqwan. Paykunaqa ñit’ispa t’ikrakunku, manataq kuyurichispachu; kayqa huk decisión intencional de diseño nisqa.
Urmachiykuna huk kimsa kaq biblioteca kaqpi ruwasqa kanku, Popper.js , mayqinchus kallpasapa churayta chaymanta qhaway punku tariyta qun. Aswan allinta popper.min.js kaqmanta churay manaraq Bootstrap JavaScript kaqmanta utaq bootstrap.bundle.min.js
/ llamk'achiy bootstrap.bundle.js
mayqinchus Popper.js kaqta hap'in. Popper.js mana llamk'achkanchu urquykunata navbars kaqpi churanapaq ichaqa imaynachus dinamico churay mana mañasqachu.
Sichus JavaScriptniykumanta pukyuta ruwachkanki, chayta munanutil.js
.
WAI ARIA kamachiy huk chiqa widget kaqmanta riqsichin , ichaqa kayqa ruwana-hina menúkuna ruwanapaq específico kaq mayqinkunachus ruwaykunata utaq ruwanakunata llamk'achinku. ARIA menúkuna menú elementokuna, cuadro de comprobación menú elementokuna, radio botón menú elementokuna, radio botón qutukuna chaymanta huch'uy menúkunalla kanman.role="menu"
Bootstrap kaqpa uraykachiyninkuna, wak ladumanta, ruwasqa kanku genérico kanankupaq chaymanta imaymana situacionkunaman chaymanta marka estructurakunaman ruwanapaq. Ejemplopaq, atikunmi ruwayta urayk'aqkuna mayqinkunachus yapa yaykuykunayuq chaymanta formulario kamachiykunayuq, maskana pampakuna utaq yaykuy formulariokuna hina. Kayrayku, Bootstrap mana suyanchu (nitaq kikinmanta yapanchu) mayqin role
chaymanta aria-
atributokuna chiqa ARIA menúkunapaq mañasqa. Qillqaqkuna kikinku kay aswan específico atributokunata churananku kanqa.
Ichaqa, Bootstrap ruwasqa yanapakuyta yapan aswan estándar teclado menú tinkiykuna kaqpaq, kayhina sapalla .dropdown-item
elementokuna kuyuy atiy kay cursor llavekuna llamk'achispa chaymanta menú ESCllavewan wichq'ay.
Uraykaqpa tikrayninta (botonniyki utaq t'inkiyki) chaymanta urayk'aq menú ukhupi .dropdown
, utaq huk elemento willaq position: relative;
. Dropdowns kaqmanta <a>
utaq <button>
elementokunamanta llamk'achisqa kanman aswan allinta tupananpaq atikuq necesidadniykiman.
Ima .btn
sapallapas huk urayk'aq tikrayman tikray atikun wakin marka tikraykunawan. Kaypi imaynatachus mayqin <button>
elementokunawanpas llamk'achiyta atinki:
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown button
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
Y con <a>
elementos:
<div class="dropdown show">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown link
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
Aswan allin kaqninqa kayta ruwayta atinki mayqin botón variante kaqwanpas, chaymanta:
Kikillantataq, rakisqa botón urayk'aqkunata ruway yaqa kikin markawan huklla botón urayk'aqkunawan, ichaqa yapasqawan .dropdown-toggle-split
allin espaciamientopaq urayk'aq caret muyuriqpi.
Kay yapasqa claseta llamk'achiyku horizontalta padding
iskaynin lado caret kaqpi 25% pisiyachinaykupaq chaymanta chaymanta chay margin-left
yapasqa sapa kuti botón urayk'achiqkunapaq hurquyku. Chay yapasqa tikraykunaqa caretta rakisqa botón kaqpi chawpichasqata waqaychanku chaymanta huk aswan allin sayayniyuq tupachiy áreata qun hatun botón kaqpa ladunpi.
Botón urayk'aqkunaqa tukuy sayayniyuq botones kaqwan llamk'anku, ñawpaqmanta chaymanta rakisqa urayk'aq botones kaqwan.
Tayta elementoman yapaspa elementokuna hawapi urayk'aq menúkunata .dropup
llamk'achiy.
Tayta elementoman yapaspa elementokunap paña larunpi urayk'aq menúkunata llamk'achiy .dropright
.
Tayta elementoman yapaspa elementokunap lluq'inpi urayk'aq menúkunata llamk'achiy .dropleft
.
Históricamente urayk'aq menú contenidokuna t'inkikuna kanan karqan , ichaqa manaña chayhinachu v4 kaqwan. Kunanqa akllanamanta elementokunata llamk'achiyta atinki urayk'achiyniykikunapi s <button>
nisqallamanta ranti .<a>
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenu2">
<button class="dropdown-item" type="button">Action</button>
<button class="dropdown-item" type="button">Another action</button>
<button class="dropdown-item" type="button">Something else here</button>
</div>
</div>
Ñawpaqmanta, huk urayk'aq menú kikinmanta churasqa 100% patamanta chaymanta tayta-mamanpa paña ladonpi. Hukman yapay .dropdown-menu-right
pañaman .dropdown-menu
urayk’aq menú nisqapi chiqanchay.
¡Umakuna wichayman! Dropdowns Popper.js kaqman gracias nispa churasqa kanku (salvo mayk'aq huk navbar kaqpi tarikunku).
<div class="btn-group">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Right-aligned menu
</button>
<div class="dropdown-menu dropdown-menu-right">
<button class="dropdown-item" type="button">Action</button>
<button class="dropdown-item" type="button">Another action</button>
<button class="dropdown-item" type="button">Something else here</button>
</div>
</div>
Ima urayk'aq menú kaqpipas ruwanakuna t'aqakunata etiquetananpaq huk umalliqta yapay.
<div class="dropdown-menu">
<h6 class="dropdown-header">Dropdown header</h6>
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
</div>
Huk rakiqwan tupaq menú nisqapi kaq huñukunata t'aqay.
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Separated link</a>
</div>
Huk formulariota huk urayk'aq menú ukhupi churay, utaq huk urayk'aq menú kaqman ruway, chaymanta margen utaq relleno yanapakuykunata llamk'achiy mana allin espaciota qunaykipaq munasqaykita.
<div class="dropdown-menu">
<form class="px-4 py-3">
<div class="form-group">
<label for="exampleDropdownFormEmail1">Email address</label>
<input type="email" class="form-control" id="exampleDropdownFormEmail1" placeholder="[email protected]">
</div>
<div class="form-group">
<label for="exampleDropdownFormPassword1">Password</label>
<input type="password" class="form-control" id="exampleDropdownFormPassword1" placeholder="Password">
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="dropdownCheck">
<label class="form-check-label" for="dropdownCheck">
Remember me
</label>
</div>
<button type="submit" class="btn btn-primary">Sign in</button>
</form>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">New around here? Sign up</a>
<a class="dropdown-item" href="#">Forgot password?</a>
</div>
<form class="dropdown-menu p-4">
<div class="form-group">
<label for="exampleDropdownFormEmail2">Email address</label>
<input type="email" class="form-control" id="exampleDropdownFormEmail2" placeholder="[email protected]">
</div>
<div class="form-group">
<label for="exampleDropdownFormPassword2">Password</label>
<input type="password" class="form-control" id="exampleDropdownFormPassword2" placeholder="Password">
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="dropdownCheck2">
<label class="form-check-label" for="dropdownCheck2">
Remember me
</label>
</div>
<button type="submit" class="btn btn-primary">Sign in</button>
</form>
.active
Uraykachiypi kaq imakunaman yapay ruwasqa hina estilochanaykipaq .
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Regular link</a>
<a class="dropdown-item active" href="#">Active link</a>
<a class="dropdown-item" href="#">Another link</a>
</div>
Mana llamk'achisqa hina estilochanaykipaq.disabled
urayk'achiqpi kaq imakunaman yapay .
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Regular link</a>
<a class="dropdown-item disabled" href="#">Disabled link</a>
<a class="dropdown-item" href="#">Another link</a>
</div>
Willay atributokuna utaq JavaScript kaqnintakama, urayk'aq plugin pakasqa willayta (urquq menúkuna) tikran .show
tayta lista kaqpi claseta tikraspa. Atributo data-toggle="dropdown"
huk ruwana patapi urayk'aq menúkuna wichq'anapaq hapipakun, chayrayku allin yuyay sapa kuti llamk'achinapaq.
Llachpanapaq atichisqa dispositivokunapi, huk urayk'achiq kichayqa ch'usaq ( $.noop
) hap'iqkuna elementopa mouseover
chaylla wawankunaman yapan. <body>
Kay admitisqa millay hack necesario llamk'anapaq muyuriqpi huk quirk kaqpi iOS' evento delegación , mayqinchus wakhina hark'anman huk grifo maypipas hawa urayk'aqmanta kay código llamk'achiyta chaymanta chay urayk'ayta wichq'an. Huk kuti urayk'achiq wichq'asqa kaqtin, kay yapasqa ch'usaq mouseover
hap'iqkuna hurqusqa kanku.
data-toggle="dropdown"
Huk t'inkiman utaq ñit'inaman yapay huk urayk'achiqta tikranaykipaq.
JavaScript nisqawan urayk'achiqkunata waqyay:
data-toggle="dropdown"
kunankamapas mañasqaraqmi kachkan
Imayna kaptinpas sichus JavaScript kaqnintakama urayk'achisqayki waqyanki utaq aswanpas data-api kaqwan llamk'achkanki, data-toggle="dropdown"
sapa kuti urayk'aqpa elemento desencadenante kaqpi kanan tiyan.
Akllanakuna willay layakuna utaq JavaScript kaqnintakama pasayta atikun. Willayta layakunapaq, akllana sutita yapay data-
, imaynachus data-offset=""
.
Suti | Niraq | Ñawpaqchasqa | Willay |
---|---|---|---|
offset nisqa | yupay | q'aytu | ruway | 0. | Desplazamiento de la desplegable relativo a su meta. Aswan willakuypaq qhaway Popper.js kaqpa offset docs . |
kuyuchiy | boolean nisqa | chiqaq | Permitir Dropdown flip en caso de un superposición en el elemento de referencia. Aswan willakuypaq qhaway Popper.js kaqpa flip docs . |
frontera | q'aytu | imakuna | 'scrollParent' nisqa. | Desbordamiento hark'ay frontera urayk'aq menú kaqmanta. 'viewport' , 'window' , 'scrollParent' , icha HTMLElement willaypa chanikunata chaskikun (JavaScriptlla). Aswan willakuypaq qhaway Popper.js kaqpa preventOverflow qillqakuna . |
Reparay mayk'aq boundary
huk chaniman churasqa kachkan mana 'scrollParent'
, estiloqa waqaychanaman position: static
churasqa .dropdown
.
Imayna | Willay |
---|---|
$().dropdown('toggle') |
Huk qusqa navbar utaq tablayuq puriypa urayk'aq menú kaqninta tikran. |
$().dropdown('update') |
Huk elementopa urayk'achiqpa maypi kayninta musuqchan. |
$().dropdown('dispose') |
Huk elementopa uraykamuyninta chinkachin. |
Llapan urayk'aq ruwaykuna 's tayta elemento kaqpi rawrasqa .dropdown-menu
chaymanta huk relatedTarget
propiedadniyuq, mayqinpa chaninmi toggling ancla elemento.
Ruwana | Willay |
---|---|
show.bs.dropdown |
Kay ruwayqa chaylla rawrarin mayk'aq rikuchiy instancia método waqyasqa. |
shown.bs.dropdown |
Kay ruwayqa llamk'achisqa kachkan mayk'aq urayk'achiq ruwaqman rikukuq ruwasqa (CSS tikraykunata suyanqa, tukusqa kananpaq). |
hide.bs.dropdown |
Kay ruwayqa chaylla llamk'achisqa kan mayk'aq pakay instancia ñan waqyasqa. |
hidden.bs.dropdown |
Kay ruwayqa llamk'achisqa kanqa mayk'aq urayk'achiq llamk'achiqmanta pakasqa kayta tukusqa (CSS tikraykunata suyanqa, tukusqa kananpaq). |