Source

Dropdowns

Toggle contextual obducit ad indicem nexuum et plus 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 voluntarium est.

Guttae in tertia parte bibliothecae, Popper.js , quae dynamicam positionem et aspectum detectionis praebet. Vide includere popper.min.js ante Bootstrap scriptor JavaScript vel usus bootstrap.bundle.min.js/ bootstrap.bundle.jsquod continet Popper.js. Popper.js in navbaribus stillicidiis positis non adhibetur, sed positione dynamica 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" 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>

Et cum <a>elementis;

<div class="dropdown">
  <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>

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-haspopup="true" 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 conjunctione scissurae medias et aptius amplitudo hit 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-haspopup="true" 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-haspopup="true" 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-haspopup="true" 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-haspopup="true" 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-haspopup="true" aria-expanded="false">
    <span class="sr-only">Toggle Dropdown</span>
  </button>
  <div class="dropdown-menu">
    ...
  </div>
</div>

Directiones

Dropup

Felis dropdown menus elementorum superne 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-haspopup="true" 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-haspopup="true" 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-haspopup="true" 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-haspopup="true" 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-haspopup="true" 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" role="group">
    <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" 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" 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>

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" href="#">Disabled link</a>
  <a class="dropdown-item" href="#">Another link</a>
</div>

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

Capita! Guttae ponuntur agentes Popper.js (nisi cum in navbar contineantur).

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

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 quod verisimile tibi erit stylorum ampliationum additionales ad constringendum latitudinem menu.

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

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" id="dropdownMenuOffset" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-offset="10,20">
      Offset
    </button>
    <div class="dropdown-menu" aria-labelledby="dropdownMenuOffset">
      <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" id="dropdownMenuReference" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-reference="parent">
      <span class="sr-only">Toggle Dropdown</span>
    </button>
    <div class="dropdown-menu" aria-labelledby="dropdownMenuReference">
      <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 indice item parente. Tributum data-toggle="dropdown"nititur ut menus dropdown claudendi in applicatione gradu, sic utilem uti semper est.

In machinis tactus parabilibus aperiens guttam vacuas ( $.noop) mouseovertractores immediatis pueris <body>elementi addit. 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 id="dLabel" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Dropdown trigger
  </button>
  <div class="dropdown-menu" aria-labelledby="dLabel">
    ...
  </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. For more information refer to Popper.js's offset docs .
flip Boolean verum Patitur Dropdown ut flip si imbricatis in elemento referente. Pro maiori notitia refertur ad Popper.js'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.js's preventOverflow docs .
reference string | elementum 'toggle' Relatio elementum tellus. Valores rerum 'toggle', 'parent', vel HTMLElement referentiae acceptat. For more information refer to Popper.js's referenceObject docs .
ostentus filum 'dynamic' Defalta, Popper.js utimur pro positione dynamica. Hoc disable cum static.

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('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 Hic eventus statim accensus est, cum methodus pelliculae instantia vocata est.
hidden.bs.dropdown Eventus hic accensus est cum stillicidium ab usore celatum absolvit (exspectabit CSS transitiones, ut perficiam).
$('#myDropdown').on('show.bs.dropdown', function () {
  // do something…
})