in English

Mbelata

Gbanwee ihe mkpuchi gburugburu maka igosipụta ndepụta njikọ yana ihe ndị ọzọ na ngwa mgbakwunye Bootstrap.

Nchịkọta

Mbudata bụ mgbanwe mgbanwe, machie gburugburu maka igosipụta ndepụta njikọ yana ndị ọzọ. Ejiri ngwa mgbakwunye Bootstrap dropdown Javascript mekọrịta ha. A na-atụgharị ha site na ịpị, ọ bụghị site na ịnyagharị; Nke a bụ mkpebi imewe nke a kpachapụrụ anya .

A na-ewu mkpọda n'ọbá akwụkwọ nke ndị ọzọ, Popper , nke na-enye ọnọdụ dị ike na nchọpụta nlele. Jide n'aka na ị gụnyere popper.min.js tupu Bootstrap's JavaScript ma ọ bụ jiri bootstrap.bundle.min.js/ bootstrap.bundle.jsnke nwere Popper. A naghị eji popper dobe dropdowns na navbars n'agbanyeghị na ọ dịghị mkpa n'ọnọdu ike.

Ọ bụrụ na ị na-ewu Javascript anyị site na isi iyi, ọ chọrọutil.js .

Nnweta

Ọkọlọtọ WAI ARIA na -akọwapụta role="menu"wijetị n'ezie , mana nke a bụ kpọmkwem maka ngwa-dị ka ngwa nke na-akpalite omume ma ọ bụ ọrụ. Nchịkọta ARIA nwere ike ịnwe naanị ihe nchịkọta nhọrọ, ihe nchịkọta nhọrọ igbe igbe, ihe nchịkọta nhọrọ bọtịnụ redio, otu bọtịnụ redio, na obere menus.

N'aka nke ọzọ, emebere bootstrap's dropdowns ka ọ bụrụ ọnụ na ọdabara n'ọnọdụ dị iche iche yana nhazi akara. Dịka ọmụmaatụ, ọ ga-ekwe omume ịmepụta mkpọda nwere ntinye agbakwunyere yana njikwa ụdị, dị ka mpaghara ọchụchọ ma ọ bụ ụdị nbanye. N'ihi nke a, Bootstrap anaghị atụ anya (ma ọ bụ tinye ya ozugbo) nke ọ bụla rolena aria-njirimara achọrọ maka ezigbo menus ARIA . Ndị ode akwụkwọ ga-etinyerịrị njirimara ndị a n'onwe ha.

Agbanyeghị, Bootstrap na-agbakwunye nkwado arụnyere n'ime ọtụtụ mmekọrịta menu nke ahụigodo, dị ka ike iji .dropdown-itemigodo cursor mechie menu site na ihe ESCdị iche iche.

Ihe atụ

Kechie ngbanwe nke dropdown (bọtịnụ gị ma ọ bụ njikọ gị) yana menu ndọpụta n'ime .dropdown, ma ọ bụ ihe ọzọ na-ekwupụta position: relative;. Enwere ike ịkpalite mbelata site na <a>ma ọ bụ <button>ihe iji kwado mkpa gị nke ọma.

Otu bọtịnụ

Enwere .btnike ịtụgharị otu ọ bụla ka ọ bụrụ ntụgharị mkpọda nwere ụfọdụ mgbanwe akara. Nke a bụ otu ị ga-esi tinye ha ka ha jiri <button>ihe abụọ ọ bụla rụọ ọrụ:

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

Na <a>ihe ndị a:

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

Akụkụ kachasị mma bụ na ị nwere ike ime nke a site na iji ụdị bọtịnụ ọ bụla, kwa:

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

bọtịnụ gbawara

N'otu aka ahụ, mepụta mkpọda bọtịnụ nkewa nwere ihe fọrọ nke nta ka ọ bụrụ otu akara dị ka otu ndetu bọtịnụ, mana yana mgbakwunye .dropdown-toggle-splitmaka oghere kwesịrị ekwesị n'akụkụ ebe nchekwa dropdown.

Anyị na-eji klaasị mgbakwunye a iji belata kehoraizin paddingn'akụkụ ọ bụla nke nlekọta ahụ site na 25% wee wepụ margin-leftnke ahụ agbakwunyere maka ndetu bọtịnụ oge niile. Mgbanwe ndị ahụ na-eme ka nlekọta ahụ dabere na bọtịnụ gbawara agbawa wee wepụta mpaghara kụrụ nke ọma karịa n'akụkụ bọtịnụ isi.

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

Nha nha

Mbelata bọtịnụ na-arụ ọrụ na bọtịnụ nha niile, gụnyere ndabara na bọtịnụ mwụda gbawara agbawa.

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

Ntuziaka

Mbupu

Kpalite menu ndọda n'elu ihe site na ịgbakwunye .dropupna mmewere nne na nna.

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

Kpalite menu ndọda n'aka nri nke ihe ndị ahụ site na ịgbakwunye .droprightna mmewere nne na nna.

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

Mbupu

Kpalite menu ndọda n'aka ekpe nke ihe ndị ahụ site na ịgbakwunye .dropleftna mmewere nne na nna.

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

Ọdịnaya menu ndetu nke akụkọ ihe mere eme ga-abụrịrị njikọ, mana nke ahụ abụghịzi ikpe na v4. Ugbu a ị nwere ike iji <button>ihe dị na dropdowns gị na nhọrọ nhọrọ kama naanị <a>s.

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

Ị nwekwara ike iji .dropdown-item-text. Na-enwere onwe gị ịke ọzọ site na iji CSS omenala ma ọ bụ ngwa ederede.

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

Na-arụ ọrụ

Tinye .activena ihe ndị dị na ndọpụta iji mee ka ha dị ka ndị na-arụ ọrụ .

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

Agbanyụrụ

Tinye .disabledna ihe ndị dị na ndọpụta iji mee ka ha nwee nkwarụ .

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

Site na ndabara, a na-edobe menu ndetu ozugbo 100% site na elu yana n'akụkụ aka ekpe nke nne na nna ya. Tinye .dropdown-menu-rightna a .dropdown-menun'aka nri kwado menu ndọpụta.

Welie isi elu! A na-edobe ihe ndọghachi azụ n'ihi Popper (belụsọ mgbe ọ dị na navbar).
<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>

Nkwekọrịta na-anabata

Ọ bụrụ n’ịchọrọ iji nzizi na-anabata, gbanyụọ ndoro-ndoro siri ike site n'ịgbakwunye data-display="static"njirimara wee jiri klaasị mgbanwe na-anabata.

Ka ịtọọ nri ndakpọ menu na ebe ezumike enyere ma ọ bụ ka ukwuu, tinye .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>

Iji dokwaa menu ndọpụta aka ekpe.dropdown-menu-right yana ebe nkwụsịtụ enyere ma ọ bụ ka ukwuu, gbakwunye na .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>

Rịba ama na ịkwesighi ịgbakwunye data-display="static"àgwà na bọtịnụ dropdown na navbars, ebe ọ bụ na ejighị Popper na navbars.

nkụnye eji isi mee

Tinye nkụnye eji isi mee ka aha ngalaba omume na nchịkọta nhọrọ ọ bụla.

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

Ndị nkesa

Kewapụ iche nke ihe nchịkọta nhọrọ nwere nkesa.

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

Ederede

Debe ederede freeform ọ bụla n'ime menu ndọpụta nwere ederede wee jiri akụrụngwa oghere . Mara na ị ga-achọ ụdị nha nha ọzọ iji gbochie obosara 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>

Ụdị

Tinye mpempe akwụkwọ n'ime menu ndọpụta, ma ọ bụ mee ya ka ọ bụrụ menu ndọpụta, ma jiri oke ma ọ bụ ihe nkpuchi iji nye ya ohere na-adịghị mma ịchọrọ.

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

Jiri data-offsetma ọ bụ data-referencegbanwee ebe ndọpụta ahụ.

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

Ojiji

Site na njirimara data ma ọ bụ Javascript, ngwa mgbakwunye na-atụgharị ọdịnaya zoro ezo (nchịkọta mkpọda) site na ịtụgharị .showklas na nne na nna .dropdown-menu. A data-toggle="dropdown"na-adabere na njirimara a maka imechi menus dropdown na ọkwa ngwa, yabụ ọ dị mma iji ya mgbe niile.

Na ngwaọrụ enyere aka, imepe mkpọda na-agbakwunye ndị na-ahụ maka ihe efu ( $.noop) mouseoverna ụmụaka nke <body>mmemme ahụ. Nke a na-ekweta jọrọ njọ mbanye anataghị ikike dị mkpa na-arụ ọrụ gburugburu a quirk na iOS' event nnọchiteanya , nke ga-ma ọ bụghị gbochie a mgbata n'ebe ọ bụla n'èzí dropdown si ịkpalite koodu na-emechi dropdown. Ozugbo emechiri ndọpụta ahụ, a mouseoverga-ewepụ ndị njikwa efu ndị ọzọ.

Site na njirimara data

Tinye data-toggle="dropdown"na njikọ ma ọ bụ bọtịnụ ka ịgbanwee mkpọda.

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

Site na Javascript

Kpọọ dropdowns site na Javascript:

$('.dropdown-toggle').dropdown()
data-toggle="dropdown"ka achọrọ

N'agbanyeghị ma ị na-akpọ dropdown gị site na Javascript ma ọ bụ kama iji data-api, data-toggle="dropdown"a na-achọrọ mgbe niile ịnọ na ihe mkpalite dropdown.

Nhọrọ

Enwere ike ịfefe nhọrọ site na njirimara data ma ọ bụ Javascript. Maka njirimara data, tinye aha nhọrọ na data-, dị ka ọ dị na data-offset="".

Aha Ụdị Ọdabara Nkọwa
nkwụsị nọmba | eriri | ọrụ 0

Nkwụsị nke ndapụta n'akụkụ ebumnuche ya.

Mgbe ejiri rụọ ọrụ iji chọpụta nkwụghachi, a na-akpọ ya ya na ihe nwere data nkwụsị dị ka arụmụka mbụ ya. Ọrụ ahụ ga-eweghachite ihe nwere otu nhazi ahụ. A na-agafe oghere DOM na-akpalite dị ka arụmụka nke abụọ.

Maka ozi ndị ọzọ rụtụ aka na docs offset Popper .

tụgharịa boolean eziokwu Kwe ka ọ daa ka ọ tụgharịa ma ọ bụrụ na ọ dakọtara na mmewere ntụaka. Maka ozi ndị ọzọ rụtụ aka na docs tụgharịa nke Popper .
oke eriri | mmewere 'mpịakọta nne na nna' Oke oke mmachi nke menu ndọpụta. Nabata ụkpụrụ nke 'viewport', 'window', 'scrollParent', ma ọ bụ HTMLElement ntụaka (naanị JavaScript). Maka ozi ndị ọzọ rụtụ aka na docs preventoverflow nke Popper .
ntụaka eriri | mmewere 'ịtụgharị' Ihe nrụtụ aka nke menu ndọpụta. Nabata ụkpụrụ nke 'toggle', 'parent', ma ọ bụ ntụnye aka HTMLElement. Maka ozi ndị ọzọ rụtụ aka na akwụkwọ ntuziaka PopperObject .
ngosi eriri 'dị ike' Site na ndabara, anyị na-eji Popper maka idobe ike. Gbanyụọ nke a na static.
popperConfig efu | ihe efu Ka ịgbanwee ndabara Bootstrap Popper config, hụ nhazi nke Popper

Rịba ama mgbe boundaryatọrọ na uru ọ bụla na-abụghị 'scrollParent', a na position: static-etinye ụdị ahụ na .dropdownakpa ahụ.

Ụzọ

Usoro Nkọwa
$().dropdown('toggle') Na-atụgharị menu mwụda nke navbar enyere ma ọ bụ igodo taabụ.
$().dropdown('show') Na-egosi ndetu mwepu nke navbar enyere ma ọ bụ igodo taabụ.
$().dropdown('hide') Na-ezobe menu mwụda nke navbar enyere ma ọ bụ igodo taabụ.
$().dropdown('update') Na-emelite ọnọdụ nke dropdown element.
$().dropdown('dispose') Na-emebi mwepu nke mmewere.

Ihe omume

A na-achụpụ mmemme ndakpọ niile .dropdown-menuna mmewere nne na nna ma nwee relatedTargetakụrụngwa, nke uru ya bụ mmewere arịlịka na-atụgharị. hide.bs.dropdownna hidden.bs.dropdownihe omume nwere ihe clickEventonwunwe (naanị mgbe ụdị ihe omume mbụ bụ click) nke nwere ihe omume maka ihe omume pịa.

Ihe omume Nkọwa
show.bs.dropdown Ihe omume a na-agba ọkụ ozugbo a na-akpọ usoro ihe ngosi.
shown.bs.dropdown A na-agbanyụ mmemme a mgbe onye ọrụ mere ka mwepu ahụ hụ ya (ga-echere mgbanwe CSS, ka ọ mechaa).
hide.bs.dropdown A na-agbapụ mmemme a ozugbo a kpọrọ usoro ihe nleba anya.
hidden.bs.dropdown A na-agbapụ mmemme a mgbe ezoro ezoro ya n'aka onye ọrụ dropdown (ga-echere mgbanwe CSS, iji wuchaa).
$('#myDropdown').on('show.bs.dropdown', function () {
  // do something...
})