in English

Dropdowns

Toggle contextual obducit ad indicem nexuum et magis cum Bootstrap dropdown plugin ostendendo.

Overview

Guttae sunt toggleabiles, contextuales obducat ad indices nexuum et plura ostendendos. Interactive fiunt cum inclusa Bootstrap dropdown JavaScript plugin. strepitando, non volando; Hoc consilium est consilium voluntarium .

Guttae in tertia factionis bibliotheca, Popper , quae dynamicam positionem et aspectum deprehensionem praebet. Vide includere popper.min.js ante Bootstrap JavaScript vel usus bootstrap.bundle.min.js/ bootstrap.bundle.jsquod continet Popper. Popper in navbaribus positis stillicidiis usus non est, quamquam positus dynamicus non requiritur.

Si JavaScript a fonte aedificas, postulatutil.js .

Accessibility

Vexillum WAI ARIA actualem notionem definit role="menu", sed hoc specificum est applicationis quasi menus, qui actus vel munera trigger. ARIA menus non potest tantum continere menu, checkbox menu items, puga pyga radiophonica, circulos globulos radiophonicos, et sub-menus.

Stillicidium Bootstrap, contra, genera esse dicuntur et variis condicionibus ac notae structurae applicari. Exempli gratia, stillicidia creare potest quae additional initibus ac moderantibus formas continent, sicut quaerere agros vel formas login. Quam ob rem, Bootstrap non exspectat (nee automatice addendi) aliquem ex attributis roleet aria-attributis pro vero ARIA menus requisitis. Auctores haec subtilius ipsa attributa complecti debebunt.

Nihilominus, Bootstrap constructum-in subsidiis ad plus claviaturae menu interactionum vexillum addit, ut facultas movendi per singula .dropdown-itemelementa utens clavibus cursori et ESCclavem claudat.

Exempla

Involve dropdown's toggle (button vel ligamen tuum) et in menu dropdown intus .dropdown, vel aliud elementum quod declarat position: relative;. Guttae urguere possunt ex elementis <a>vel <button>ad necessitates potentiales melius aptandas.

Unius button

Quaevis una .btnverti potest in stillicidium cum quibusdam notis mutationibus. Ecce quomodo potes eos laborare cum <button>elementis;

<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>

Et cum <a>elementis;

<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>

Optima pars est, hoc facere potes cum aliqua conjunctione variantis, etiam:

<!-- 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>

Scinditur button

Similiter, stillicidiis globulorum scissilis crea cum eodem fere signo ut stillicidiis globulorum unius, sed cum additione .dropdown-toggle-splitpropriae spatii circa dropdown caret.

Hoc extra genus utimur ad redigendum horizontalem paddingin utraque parte custodiae per 25% et removendum margin-leftquod additum est pro stillicidiis bullis regularibus. Illae extra mutationes custodiunt custodias in botones scissuras versatas et aptius amplitudo aream proximam cum globulo principali praebent.

<!-- 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>

inspectionem

Button dropdowns operantur cum globulis omnium magnitudinum, incluso defalta et scissurae globuli stillicidii.

<!-- 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>

Directiones

Dropup

Menus felis dropdown super elementis addendo .dropupad elementum parentis.

<!-- 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>

Dropright

Menus felis tellus elementum dextram elementorum addendo .droprightad parentem.

<!-- 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>

Dropleft

Menus felis tellus elementum sinistrum addendo .dropleftad parentis elementum.

<!-- 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>

Historice dropdown menu contenta nexus esse oportuit , sed id non iam causam cum v4. Nunc optione uti <button>elementis in stillicidiis tuis loco iustorum potes uti <a>.

<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>

Potes etiam creare non-interactive dropdown items cum .dropdown-item-text. Libenter sentire cum consuetudine CSS vel textu utilitatis edicere.

<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>

Active

Add .activeto items in the dropdown to style them as active .

<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>

debilitatum

Add .disabledto items in the dropdown to style them as disabled .

<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>

Defalta, menu guttatim a summo C% ipso et in sinistro parentis sui latere collocatur. Adde .dropdown-menu-rightad .dropdown-menudextram align menu.

Capita! Guttae gratiae Poppaeae positi sunt (nisi cum in navbare continentur).
<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>

Responsivum alignment

Si alignment responsiva uti voles, inactivare positionis dynamicam addito data-display="static"attributo et utere variationi responsiva classium.

Ad align rectam menu dropdown dato breakpoint vel majori, adde .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>

Ad align left menu dropdown dato breakpoint aut majoribus, adde .dropdown-menu-rightet .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>

Nota te non opus esse data-display="static"attributum globulis in navbaribus stillae, cum Popper in navbaribus non adhibetur.

Capitis

Caput addere sectiones pittacii actionum in quavis dropdown menu.

<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>

Dividers

Singulas tabulas relatas cum divisore.

<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>

Textum

Pone aliquem textum freeformi intra menu dropdown cum textu et usu spacing utilitatum . Nota te verisimiliter opus erit stylorum amplitudines additas ad latitudinem menu constringendam.

<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>

Formae

Formam intra menu dropdown pone, aut fac in menu dropdown, et utere margine vel Nullam utilitates ad spatium negativum quod petis dare.

<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>

Utere data-offsetvel data-referencemutare locum dropdown.

<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>

Consuetudinem

Via data attributa vel JavaScript, gutta plugin toggles abscondita (dropdown menus) per toggling .showgenus in parente .dropdown-menu. Proprium data-toggle="dropdown"attributum nititur ad occlusionem menus dropdown in gradu applicationis, sic utilem uti semper est.

In machinis tactus parato aperiens guttam vacuas ( $.noop) tractores immediatis elementi mouseoverfiliis addit. <body>Hoc hack utiliter deforma est, necesse est in delegatione iOS eventum circum vafrum operari , quod alioqui impedit sonum uspiam extra guttae e codice excitato, quod stillicidium claudit. Postquam stillicidium occlusum est, accessiones inanes his mouseovertractoriae tolluntur.

Via data attributa

Adde data-toggle="dropdown"nexum vel felis toggle a dropdown.

<div class="dropdown">
  <button type="button" data-toggle="dropdown" aria-expanded="false">
    Dropdown trigger
  </button>
  <div class="dropdown-menu">
    ...
  </div>
</div>

Via JavaScript

Vocate dropdowns per JavaScript:

$('.dropdown-toggle').dropdown()
data-toggle="dropdown"adhuc requiratur

Neglegens utrum ad stillicidium tuum per JavaScript an potius utere notitia-api vocas, data-toggle="dropdown"semper requiritur adesse in elementum felis tellus.

Optiones

Optiones transigi possunt per data attributa vel JavaScript. Data enim attributa, adiungunt optionis nomen data-, ut in data-offset="".

Nomen Type Default Descriptio
offset numerus | string | officium 0

Quisque nonummy tellus vitae est iaculis accumsan.

Cum functio cinguli ad determinandum adhibetur, dicitur cum obiecto in quo primum argumentum cinguli continetur. Munus cum eadem structura reddere debet. Nodus domne elementum excitato praecessit ut secundum argumentum.

For more information refer to Popper's offset docs .

flip Boolean verum Patitur Dropdown ut flip si imbricatis in elemento referente. For more information refer to Popper's flip docs .
terminus string | elementum 'scrollParent' Exundant angustiae limitis dropdown menu. Valores 'viewport', 'window', 'scrollParent'vel HTMLElement (JavaScript tantum). For more information refer to Popper's preventOverflow docs .
reference string | elementum 'toggle' Relatio elementum tellus. Valores rerum 'toggle', 'parent', seu referentiae HTMLElement acceptat. For more information refer to Popper's referenceObject docs .
ostentus filum 'dynamic' Defalta, Popper pro positione dynamica utimur. Hoc disable cum static.
popperConfig null | object null Mutare Bootstrap default Popper config, vide configurationem Popper

Nota quando boundaryad quemvis alium quam ad valorem ponitur 'scrollParent', stilus position: staticad modum .dropdowncontinens.

Methodi

Methodus Descriptio
$().dropdown('toggle') Toggles menu destillatio navigationis datae navbaris vel tabbed.
$().dropdown('show') Monstrat tabulatum distillationis cuiusdam navigationis navbaris vel tabb.
$().dropdown('hide') Celat in menu dropdown datae navigationis navbaris vel tabbed.
$().dropdown('update') Renovat positionem elementi tellus.
$().dropdown('dispose') Praesent elementum suscipit tellus.

Events

Omnes guttae eventus ad .dropdown-menuparentis elementum accensi sunt ac relatedTargetproprietatem habent, cuius valor est ancora toggling elementum. hide.bs.dropdownet hidden.bs.dropdowneventus clickEventproprietatem habent (tantum cum primo eventu generis est click) quae eventum Object pro eventu strepita continet.

Eventus Descriptio
show.bs.dropdown Huius rei incendia statim cum spectaculum instantia methodus appellatur.
shown.bs.dropdown Eventus hic accensus est cum stillicidium usori visibile factum est (exspectabit CSS transitus, ut perficiat).
hide.bs.dropdown Ea res statim accensus est, cum occultae instantiae methodus vocata est.
hidden.bs.dropdown Eventus hic accensus est cum stillicidium ab usore celatum absolvit (exspectabit CSS transitus, ut perficiat).
$('#myDropdown').on('show.bs.dropdown', function () {
  // do something...
})