Umi desplegable rehegua
Embohasa umi ñembojehe’a contextual rehegua ehechauka hag̃ua umi lista enlace ha hetave mba’e Bootstrap plugin desplegable reheve.
Tembiecharã
Umi desplegable ha’e toggleable, contextual superposición ojehechauka hag̃ua umi lista enlace rehegua ha hetave mba’e. Ojejapo hikuái interactivo pe JavaScript plugin desplegable Bootstrap oikeva’ekue ndive. Oñembohasa hikuái clic rupive, ndaha’éi ojehoverávo; kóva ha'e peteî decisión intencional diseño reheguáva .
Umi desplegable oñemopuꞌa peteĩ aranduka mbohapýha rehegua, Popper , omeꞌeva ñemohenda dinámico ha jehechakuaa jehechaukaha. Emoĩ katuete popper.min.js Bootstrap JavaScript mboyve térã eipuru bootstrap.bundle.min.js
/ bootstrap.bundle.js
oguerekóva Popper. Popper ndojeporúi oñemohenda hag̃ua umi desplegable umi navbar-pe jepémo noñeikotevẽiháicha posicionamiento dinámico.
Emopu’ãramo ore JavaScript ypykue guive, oikotevẽutil.js
.
Accesibilidad rehegua
Pe WAI ARIA jeporupyre odefini peteĩ role="menu"
widget añetegua , ha katu kóva haꞌehína específico umi menú aplicación-ichagua omoñepyrũva tembiapo térã tembiaporã. Umi menú ARIA rehegua ikatu oguereko umi mbaꞌe menú rehegua, umi menú vore vore rehegua, umi menú botón radio rehegua, umi aty radio botón rehegua ha umi submenú añoite.
Umi bootstrap mbaꞌekuaarã katu, ojejapo haꞌe hag̃ua genérico ha ojepurukuaa hag̃ua opaichagua situación ha estructura de marcado-pe. Techapyrã, ikatu ojejapo umi desplegable oguerekóva entrada adicional ha control formulario rehegua, haꞌeháicha umi tenda jeheka térã formulario jeikerã. Upévare, Bootstrap noha’arõi (ni omoĩ ijehegui) mba’eveichagua role
ha aria-
atributo oñeikotevẽva umi menú ARIA añeteguávape g̃uarã. Umi ohaíva oikeva’erã ijeheguiete ko’ã atributo específicovéva.
Ha katu, Bootstrap omoĩve pytyvõ oñemboguapýva hetavéva teclado menú ñembojoajurãme g̃uarã, haꞌeháicha ikatuha ojeguata .dropdown-item
elemento peteĩteĩva rupive ojeporúvo umi tecla cursor ha oñemboty menú ESCtecla reheve.
Tembiecharã
Embojere pe desplegable toggle (nde botón térã enlace) ha menú desplegable ryepýpe .dropdown
, térã ambue elemento odeclaráva position: relative;
. Umi dropdown ikatu oñemboguata <a>
térã <button>
elemento-kuéragui oñemohenda porãve hag̃ua ne remikotevẽ potencial.
Peteĩ botón añoite
Oimeraẽ peteĩva .btn
ikatu oñembohasa peteĩ toggle desplegable-pe peteĩ marca ñemoambue reheve. Ko’ápe ojehechauka mba’éichapa ikatu remoĩ omba’apo hag̃ua peteĩva umi <button>
elemento ndive:
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false">
Dropdown button
</button>
<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>
</div>
Ha umi <a>
elemento reheve:
<div class="dropdown">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-expanded="false">
Dropdown link
</a>
<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>
</div>
Pe iporãvéva ha’e ikatuha rejapo kóva oimeraẽva botón variante reheve, avei:
<!-- Example single danger button -->
<div class="btn-group">
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
Action
</button>
<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>
</div>
Botón ojedividi haguã
Upéicha avei, ejapo umi desplegable botón dividido orekóva prácticamente peteĩchagua marcado umi desplegable botón peteĩva ndive, ha katu oñembojoapývo .dropdown-toggle-split
espaciado hekopete caret desplegable jerére.
Jaipuru ko clase extra ñamboguejy hag̃ua horizontal padding
mokõive lado caret-pe 25% ha jaipeꞌa pe margin-left
that’s oñembojoapýva umi botón desplegable regular-pe g̃uarã. Umi cambio extra omantene pe caret oñecentra pe botón split-pe ha ome’ẽ peteĩ área de golpe tamaño adecuadovéva pe botón principal ykére.
<!-- Example split danger button -->
<div class="btn-group">
<button type="button" class="btn btn-danger">Action</button>
<button type="button" class="btn btn-danger dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
<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>
</div>
Dimensionamiento rehegua
Umi botón desplegable ombaꞌapo umi botón opaichagua tuichakue ndive, umíva apytépe umi botón desplegable por defecto ha dividido.
<!-- Large button groups (default and split) -->
<div class="btn-group">
<button class="btn btn-secondary btn-lg dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false">
Large button
</button>
<div class="dropdown-menu">
...
</div>
</div>
<div class="btn-group">
<button class="btn btn-secondary btn-lg" type="button">
Large split button
</button>
<button type="button" class="btn btn-lg btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu">
...
</div>
</div>
<!-- Small button groups (default and split) -->
<div class="btn-group">
<button class="btn btn-secondary btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false">
Small button
</button>
<div class="dropdown-menu">
...
</div>
</div>
<div class="btn-group">
<button class="btn btn-secondary btn-sm" type="button">
Small split button
</button>
<button type="button" class="btn btn-sm btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu">
...
</div>
</div>
Direcciones rehegua
Dropup rehegua
Emoñepyrũ umi menú desplegable elementokuéra ári emoĩvo .dropup
elemento túvape.
<!-- Default dropup button -->
<div class="btn-group dropup">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
Dropup
</button>
<div class="dropdown-menu">
<!-- Dropdown menu links -->
</div>
</div>
<!-- Split dropup button -->
<div class="btn-group dropup">
<button type="button" class="btn btn-secondary">
Split dropup
</button>
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu">
<!-- Dropdown menu links -->
</div>
</div>
Gota rehegua
Emoñepyrũ umi menú desplegable umi elemento akatúape emoĩvo .dropright
elemento túvape.
<!-- Default dropright button -->
<div class="btn-group dropright">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
Dropright
</button>
<div class="dropdown-menu">
<!-- Dropdown menu links -->
</div>
</div>
<!-- Split dropright button -->
<div class="btn-group dropright">
<button type="button" class="btn btn-secondary">
Split dropright
</button>
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropright</span>
</button>
<div class="dropdown-menu">
<!-- Dropdown menu links -->
</div>
</div>
Gota rehegua
Emoñepyrũ umi menú desplegable umi elemento akatúape emoĩvo .dropleft
elemento túvape.
<!-- Default dropleft button -->
<div class="btn-group dropleft">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
Dropleft
</button>
<div class="dropdown-menu">
<!-- Dropdown menu links -->
</div>
</div>
<!-- Split dropleft button -->
<div class="btn-group">
<div class="btn-group dropleft">
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false">
<span class="sr-only">Toggle Dropleft</span>
</button>
<div class="dropdown-menu">
<!-- Dropdown menu links -->
</div>
</div>
<button type="button" class="btn btn-secondary">
Split dropleft
</button>
</div>
Umi mba’e oĩva menúpe
Históricamente umi menú desplegable contenido ha’eva’erãkuri enlace, ha katu ndaha’evéima upéicha v4-pe. Koꞌág̃a ikatu reipuru opcionalmente umi <button>
elemento nde desplegable-pe <a>
s-nte rangue.
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false">
Dropdown
</button>
<div class="dropdown-menu">
<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>
Ikatu avei ejapo umi mba’e’oka ndaha’éiva interactivo .dropdown-item-text
. Eñeñandu líbre emoĩve hag̃ua estilo CSS térã jehaipyre purupyrã jeporupyre reheve.
<div class="dropdown-menu">
<span class="dropdown-item-text">Dropdown item text</span>
<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>
Kyre'ỹ
Emoĩve .active
umi mbaꞌe oĩva pe desplegable-pe emoĩ hag̃ua estilo activo ramo .
<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>
Ñemonandi
Emoĩve .disabled
umi mba’e’oka oĩva vore’ípe emoĩ hag̃ua estilo oñemboykéva ramo .
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Regular link</a>
<a class="dropdown-item disabled">Disabled link</a>
<a class="dropdown-item" href="#">Another link</a>
</div>
Menú ñemohenda
Por defecto, peteĩ menú desplegable oñemohenda ijeheguiete 100% yvate guive ha ituvakuéra akatúa gotyo. Emoĩ .dropdown-menu-right
peteĩ .dropdown-menu
a derecha gotyo emohenda pe menú desplegable.
<div class="btn-group">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" 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>
Alineación ombohováiva rehegua
Eipuruséramo alineación ombohováiva, embogue posicionamiento dinámico emoĩvo data-display="static"
atributo ha eipuru umi clase variación ombohováiva.
Oñemohenda hag̃ua akatúa gotyo menú desplegable punto de ruptura oñeme’ẽva ndive térã tuichavéva ndive, emoĩve .dropdown-menu{-sm|-md|-lg|-xl}-right
.
<div class="btn-group">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" data-display="static" aria-expanded="false">
Left-aligned but right aligned when large screen
</button>
<div class="dropdown-menu dropdown-menu-lg-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>
Oñemohenda hag̃ua izquierda menú desplegable punto de ruptura oñemeꞌevaꞌekue ndive térã tuichavéva ndive, emoĩ .dropdown-menu-right
ha .dropdown-menu{-sm|-md|-lg|-xl}-left
.
<div class="btn-group">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" data-display="static" aria-expanded="false">
Right-aligned but left aligned when large screen
</button>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-lg-left">
<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>
Eñamindu’u natekotevẽiha emoĩ peteĩ data-display="static"
atributo umi botón desplegable-pe umi navbar-pe, Popper ndojeporúigui navbar-pe.
Menú contenido rehegua
Akãrapu’ã
Emoĩ peteĩ iñakãrapuꞌa emoĩ hag̃ua etiqueta umi tembiaporã vore oimeraẽva menú desplegable-pe.
<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>
Umi omboja’óva
Emboja’o umi aty umi elemento menú rehegua ojoajúva peteĩ divisor reheve.
<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>
Maranduhai
Emoĩ oimeraẽva jehaipyre forma libre peteĩ menú desplegable ryepýpe jehaipyre reheve ha eipuru umi utilidad espaciado rehegua . Eñamindu’u oiméne reikotevẽtaha estilo de tamaño adicional ejoko hag̃ua menú ipekue.
<div class="dropdown-menu p-4 text-muted" style="max-width: 200px;">
<p>
Some example text that's free-flowing within the dropdown menu.
</p>
<p class="mb-0">
And this is more example text.
</p>
</div>
Umi Formulario rehegua
Emoĩ peteĩ formulario peteĩ menú desplegable ryepýpe, térã ejapo peteĩ menú desplegable-pe, ha eipuru umi utilidad margen térã relleno rehegua eme’ẽ hag̃ua chupe espacio negativo reikotevẽva.
<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-group">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="dropdownCheck">
<label class="form-check-label" for="dropdownCheck">
Remember me
</label>
</div>
</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-group">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="dropdownCheck2">
<label class="form-check-label" for="dropdownCheck2">
Remember me
</label>
</div>
</div>
<button type="submit" class="btn btn-primary">Sign in</button>
</form>
Opciones desplegables rehegua
Eipuru data-offset
térã data-reference
emoambue hag̃ua moõpa oĩ pe desplegable.
<div class="d-flex">
<div class="dropdown mr-1">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false" data-offset="10,20">
Offset
</button>
<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>
</div>
<div class="btn-group">
<button type="button" class="btn btn-secondary">Reference</button>
<button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-expanded="false" data-reference="parent">
<span class="sr-only">Toggle Dropdown</span>
</button>
<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>
</div>
</div>
Jeporu rehegua
Atributo de datos térã JavaScript rupive, pe plugin desplegable ombohasa contenido kañymby (menú desplegable) ombohasávo .show
clase túvape .dropdown-menu
. Pe data-toggle="dropdown"
atributo ojejerovia oñemboty hag̃ua menú desplegable peteĩ aplicación nivel-pe, upévare iporã reipuru meme hag̃ua.
$.noop
)
mouseover
mboguatahára nandi umi
<body>
elemento memby pyaꞌetevape. Ko hack admitidamente feo oñeikotevëva omba'apo haguã peteî
quirk iOS' evento delegación , ambue mba'épe ojokóta peteî tap oimehápe okápe desplegable omoñepyrüva código ombotýva desplegable. Oñemboty rire pe desplegable,
mouseover
ojeipe’a ko’ã manipulador vacío adicional.
Umi atributo de datos rupive
Emoĩ data-toggle="dropdown"
peteĩ enlace térã botón-pe emoambue hag̃ua peteĩ desplegable.
<div class="dropdown">
<button type="button" data-toggle="dropdown" aria-expanded="false">
Dropdown trigger
</button>
<div class="dropdown-menu">
...
</div>
</div>
JavaScript rupive
Ehenói umi desplegable JavaScript rupive:
$('.dropdown-toggle').dropdown()
data-toggle="dropdown"
oñeikotevẽ gueteri
Taha’e ha’éva ehenóiva ne desplegable JavaScript rupive térã upéva rangue eipuru data-api, data-toggle="dropdown"
oñeikotevẽ akóinte oĩ presente pe desplegable elemento desencadenante-pe.
Opciones rehegua
Umi opción ikatu oñembohasa atributo de datos térã JavaScript rupive. Umi atributo dato rehegua, emoĩ opción réra data-
, -peguáicha data-offset=""
.
Téra | Hesegua | Upevakuére | Techaukaha |
---|---|---|---|
desplazamiento rehegua | papapy | cadena rehegua | hembiapo | 0 rehegua | Desplazamiento pe desplegable rehegua relativo pe meta orekóva rehe. Ojepuru jave peteĩ función ojekuaa hag̃ua desplazamiento, oñehenói peteĩ mbaꞌe oguerekóva umi dato desplazamiento rehegua iargumento peteĩha ramo. Pe función ombojevyvaꞌerã peteĩ mbaꞌe oguerekóva peteĩchagua estructura. Pe elemento desencadenante nodo DOM oñembohasa mokõiha argumento ramo. Ojeikuaave hag̃ua ehecha Popper offset docs . |
jere | booleano rehegua | teete | Eheja Dropdown ojere oikóramo peteĩ superposición elemento referencia rehegua. Ojeikuaave hag̃ua ehecha Popper flip docs . |
límite rehegua | cadena rehegua | mba'e rehegua | 'desplazamientoTúva'. | Límite restricción de desbordamiento rehegua menú desplegable rehegua. Omoneĩ umi mbaꞌekuaarã 'viewport' , 'window' , 'scrollParent' , térã peteĩ HTMLElement ñembohekopyrã (JavaScript añoite). Ojeikuaave hag̃ua ehecha Popper preventOverflow kuatiañe’ẽ . |
kuaukarã | cadena rehegua | mba'e rehegua | 'toggle' rehegua. | Elemento de referencia menú desplegable rehegua. Omoneĩ umi mbaꞌekuaarã 'toggle' , 'parent' , térã peteĩ HTMLElement ñembohekopyrã. Ojeikuaave hag̃ua ehecha Popper referenceObject docs . |
techaukahára | sã | 'dinámico' rehegua. | Por defecto, jaipuru Popper posicionamiento dinámico-pe g̃uarã. Embogue ko mba’e static . |
popperConfig rehegua | nulo rehegua | mba'e | mba'evegua | Oñemoambue hag̃ua Bootstrap Popper ñemboheko tee, ehecha Popper ñemboheko |
Eñamindu’u boundary
oñemboguapy jave oimeraẽ mba’ekuaarã ambuévape ndaha’éiva , ojeporu 'scrollParent'
estilo mba’e’oka rehe.position: static
.dropdown
Método-kuéra rehegua
Tapereko | Techaukaha |
---|---|
$().dropdown('toggle') |
Ombohasa menú desplegable peteĩ navbar térã navegación ficha oñemeꞌevaꞌekue rehegua. |
$().dropdown('show') |
Ohechauka menú desplegable peteĩ navbar térã navegación ficha oñemeꞌevaꞌekue rehegua. |
$().dropdown('hide') |
Oñomi menú desplegable peteĩ navbar térã navegación ficha oñemeꞌevaꞌekue rehegua. |
$().dropdown('update') |
Ombopyahu peteĩ elemento ñemboguejyha ñemohenda. |
$().dropdown('dispose') |
Ohundi peteĩ elemento desplegable. |
Umi mba’e oikóva
Opaite mbaꞌe ojehúva desplegable oñembopu .dropdown-menu
's elemento túva rehe ha oguereko peteĩ relatedTarget
mbaꞌekuaarã, ivalór haꞌehína elemento anclaje oñembohasáva. hide.bs.dropdown
ha hidden.bs.dropdown
umi mbaꞌe ojehúva oguereko peteĩ clickEvent
mbaꞌekuaarã (pe mbaꞌe ojehúva ypykue tipo haꞌe jave añoite click
) oguerekóva peteĩ Objeto Evento rehegua pe mbaꞌe ojehúva clic-pe g̃uarã.
Jeguerohyha | Techaukaha |
---|---|
show.bs.dropdown |
Ko mbaꞌe ojehúva oñembopu pyaꞌe oñehenói jave método instancia ohechaukáva. |
shown.bs.dropdown |
Ko mba’e ojehúva oñembogue ojejapo rire ojehecha hag̃ua puruhárape (oha’arõta umi CSS jehaipyre, oñembotývo). |
hide.bs.dropdown |
Ko mbaꞌe ojehúva oñembogue pyaꞌe oñehenói rire pe método instancia omokañyvaꞌekue. |
hidden.bs.dropdown |
Ko mba’e ojehúva oñembogue oñemokañypa rire pe desplegable puruháragui (oha’arõta CSS jehaipyre, oñembotývo). |
$('#myDropdown').on('show.bs.dropdown', function () {
// do something...
})