Bootstrap dropdown plugin hmangin link list leh a dangte tarlanna tur contextual overlays te chu toggle rawh.
A tlangpuiin
Dropdown hi toggleable a ni a, link list leh thil dang tam tak tarlanna atan contextual overlay a awm bawk. Anni chu Bootstrap dropdown JavaScript plugin dah tel hmangin interactive taka siam an ni. Anni chu click hmanga toggle an ni a, hovering hmanga toggle an ni lo; hei hi tumruh taka design chungchanga thutlukna siam a ni .
Dropdown hi third party library, Popper.js -ah siam a ni a, hei hian dynamic positioning leh viewport detection a pe thei a ni. Bootstrap-a JavaScript hmain popper.min.js kha dah hmasa phawt la, Popper.js awmna bootstrap.bundle.min.js/ hmang bootstrap.bundle.jsbawk ang che. Popper.js hi navbar-a dropdown position nan hman a ni lo nain dynamic positioning a ngai lo.
Kan JavaScript hi source atanga i siam a nih chuanutil.js .
A thlen theihna tur
WAI ARIA standard hian actual widget a define a , role="menu"mahse hei hi application ang chi menus te tan bik a ni a, chu chuan action emaw function emaw a tichhuak thin. ARIA menu-ah hian menu item, checkbox menu item, radio button menu item, radio button group, leh sub-menu te chauh a awm thei.
Bootstrap-a dropdown te erawh chu generic leh situation hrang hrang leh markup structure hrang hranga hman theih tura siam a ni thung. Entirnan, input leh form control dang awmna dropdown siam theih a ni a, chu chu search field emaw login form emaw a ni. Hemi avang hian Bootstrap hian ARIA menu dik tak atana mamawh roleleh aria-attribute pakhat mah a beisei lo (a nih loh leh automatic a add lo bawk). Lehkhabu ziaktute chuan heng attribute chiang zawkte hi anmahni ngeiin an dah tel a ngai dawn a ni.
Mahse, Bootstrap hian standard keyboard menu interaction tam zawkah chuan built-in support a dah belh a, chu .dropdown-itemchu cursor key hmanga element hrang hrang kal tlanga kal theihna leh key hmanga menu khar theihna te ESChi a ni.
Entirna te
Dropdown-a toggle (i button emaw link emaw) leh dropdown menu chu .dropdown, emaw , declare element dang emaw chhungah wrap rawh position: relative;. Dropdowns chu i mamawh theihna tur ang zawka siam turin <a>emaw elements atang emaw atanga trigger theih a ni.<button>
Button pakhat chauh a awm
Single eng pawh .btnhi dropdown toggle-ah a chantir thei a, markup thlak danglamna engemaw zat a awm bawk. <button>Hetah hian element pahnih emaw hmanga hnathawh tir theih dan tur chu hetiang hi a ni :
Chutiang bawkin, split button dropdown siam la, button pakhat dropdown ang chiah markup nen siam la, mahse .dropdown-toggle-splitdropdown caret chhehvela space dik tak neih theih nan tih belh rawh.
He extra class hmang hian paddingcaret sir lehlama horizontal chu 25% in kan tihhniam a, margin-leftregular button dropdown-a that’s added chu kan paih chhuak bawk. Chutiang extra changes chuan caret chu split button-ah centered-in a dah a, main button bulah hit area size tling zawk a pe bawk.
Historically dropdown menu contents chu link a nih a ngai a, mahse v4 ah chuan chutiang chu a ni tawh lo. Tunah chuan i dropdown-ah s chauh ai chuan optional <button>-in element i hmang thei tawh ang.<a>
Default-ah chuan dropdown menu chu a chung atanga 100% in a parent veilam sir lamah a awm nghal vek a ni. Dropdown menu chu .dropdown-menu-righta atanga dinglam hawiin add rawh ..dropdown-menu
Lu a ti sang a! Dropdown te hi Popper.js vangin an position a (navbar-a an awm lai tih loh chu).
Chhanna pe thei tur alignment
Responsive alignment hman i duh chuan attribute dah belhin dynamic positioning kha disable la data-display="static", responsive variation class te hmang rawh.
Dropdown menu chu breakpoint pek emaw a aia lian emaw nena dinglama align tur chuan .dropdown-menu{-sm|-md|-lg|-xl}-right.
Dropdown menu veilam chu breakpoint pek emaw a aia lian emaw nena align tur chuan add .dropdown-menu-rightleh .dropdown-menu{-sm|-md|-lg|-xl}-left.
Navbar-a dropdown button-ah hian attribute dah a ngai lo tih hre reng ang che data-display="static", Popper.js hi navbar-ah hman a nih loh avangin.
Menu chhunga thu awmte
Headers te pawh a awm
Dropdown menu eng pawha action section hrang hrangte label turin header dah la.
Freeform text eng pawh chu dropdown menu chhungah text awmnaah dah la , spacing utilities hmang rawh . Menu zau zawng tihtlem nan sizing style dang i mamawh mai thei tih hre reng ang che.
Dropdown menu chhunga free-flowing text entirnan thenkhat.
Tin, hei hi entirnan text a ni zawk.
Form hrang hrang
Dropdown menu chhungah form dah la, a nih loh leh dropdown menu-ah siam la, margin emaw padding utilities emaw hmangin i mamawh negative space pe rawh.
.showData attribute emaw JavaScript hmangin dropdown plugin hian parent list item-a class toggle-in thup (dropdown menu) a toggle a ni. Attribute hi data-toggle="dropdown"application level-a dropdown menu khar nan rintlak a nih avangin hman reng a tha.
Touch-enabled device-ah chuan dropdown hawn hian element fate hnaih berte hnenah handler empty ( $.noop) a belhchhah a ni. This admittedly ugly hack is necessary to work around a quirk in iOS’ event delegation , chutiang a nih loh chuan dropdown pawn lam hmun dangah tap chuan dropdown khartu code a tichhuak thei lo ang. Dropdown khar a nih veleh heng handler empty additional te hi an paih chhuak thin.mouseover<body>mouseover
JavaScript hmanga i dropdown i call emaw, a aiah data-api hmang emaw pawh nise, data-toggle="dropdown"dropdown-a trigger element-ah hian awm reng a ngai a ni.
Thil thlan theih a ni
Options chu data attribute emaw JavaScript hmangin pass theih a ni. Data attribute atan chuan option hming chu , ah hian append la data-, data-offset="".
Hming
Lampang
Hlawhchhamna
Hrilhfiahna
offset a ni
number | string | thiltih
0 a ni
A target nena khaikhin chuan dropdown offset.
Offset hriat nan function hman a nih chuan a argument hmasa ber atan offset data awmna object hmangin koh a ni. Function hian structure inang object a rawn pe chhuak tur a ni. Triggering element DOM node chu argument pahnihna atan pass a ni.
Dropdown menu ah hian overflow constraint boundary a awm a. 'viewport', 'window', 'scrollParent', emaw HTMLElement reference (JavaScript chauh) value te a pawm . Hriat belh duh chuan Popper.js-a preventOverflow docs en rawh.
kawhhmuh
string | thil bul
'toggle' a ti a.
Dropdown menu a reference element chu a rawn lang ang. 'toggle', 'parent', emaw HTMLElement reference value te a pawm . Hriat belh duh chuan Popper.js-a referenceObject docs en rawh.
tarchhuak
hrui
'dynamic' tih a ni.
Default-ah chuan Popper.js hi dynamic positioning atan kan hmang thin. Hei hi disable staticrawh .
Note tih boundaryloh value dang eng pawha set a nih chuan 'scrollParent', style chu container-ah position: statichman a ni tih hre reng ang che..dropdown
Thiltih dan tur
Tihdan
Hrilhfiahna
$().dropdown('toggle')
Navbar emaw tabbed navigation pek tawh dropdown menu chu a toggle thin.
$().dropdown('show')
Navbar emaw tabbed navigation pek tawh dropdown menu a entir.
$().dropdown('hide')
Navbar emaw tabbed navigation pek tawh dropdown menu chu a thup thin.
$().dropdown('update')
Element pakhat dropdown awmna hmun a update thin.
$().dropdown('dispose')
Element pakhat dropdown a tichhia.
Thil thlengte
Dropdown event zawng zawng hi .dropdown-menu's parent element ah fire vek a ni a, relatedTargetproperty a nei a, a value chu toggling anchor element a ni. hide.bs.dropdownleh hidden.bs.dropdownevents te hian clickEventproperty an nei a (original event type chu click) a nih chuan click event atan Event Object a awm a ni.
Hunbik
Hrilhfiahna
show.bs.dropdown
He event hi show instance method a koh chuan a fire nghal vek a ni.
shown.bs.dropdown
He event hi dropdown chu user hmuh theiha siam a nih chuan a fire thin (CSS transition a nghak ang, a zawh theih nan).
hide.bs.dropdown
He event hi hide instance method koh a nih chuan a fire nghal a ni.
hidden.bs.dropdown
He event hi dropdown chu user hnen atanga thup a nih zawh chuan a fire thin (CSS transitions a nghak ang, a zawh theih nan).