in English

Popovers te an ni

Documentation leh iOS-a hmuh ang chi Bootstrap popovers te chu i site-a element eng pawha dah belh dan tur entirnan.

A tlangpuiin

Popover plugin hman huna hriat tur awmte:

  • Popovers te hian positioning atan 3rd party library Popper an ring tlat a ni. Poppers a thawh theih nan bootstrap.js hmain popper.min.js i dah hmasa tur a ni emaw, Popper awmna bootstrap.bundle.min.js/ hmang tur a ni!bootstrap.bundle.js
  • Popovers hian tooltip plugin hi dependency atan a mamawh a ni.
  • Kan JavaScript hi source atanga i siam a nih chuanutil.js .
  • Popovers hi performance avanga opt-in a nih avangin nangmah ngeiin i initialize tur a ni .
  • Zero-length titleleh contentvalue te hian popover a lantir ngai lovang.
  • container: 'body'Component complex zawk (kan input group, button group, etc)-a rendering problem awm loh nan specify rawh .
  • Hidden elements-a popovers trigger hian hna a thawk dawn lo.
  • Popovers for .disabledor disabledelements te chu wrapper element ah trigger tur a ni.
  • Line hrang hranga wrap anchor atanga trigger a nih chuan popovers te chu anchor zawng zawng zau zawng inkar ah centered a ni ang. Hetiang thiltih hi pumpelh nan .text-nowrapi s hmangin hmang rawh .<a>
  • Popovers te hi DOM atanga an element inmil te lakchhuah a nih hmain thup a ngai a ni.
  • Shadow DOM chhunga element awm vangin popovers a trigger thei a ni.
Default-ah chuan he component hian built-in content sanitizer a hmang a, chu chuan HTML element chiang taka phal loh zawng zawng a strip chhuak vek a ni. Kan JavaScript documentation-a sanitizer section-ah hian a chipchiar zawkin en rawh .
He component hian animation effect hi prefers-reduced-motionmedia query ah a innghat a ni. Kan accessibility documentation a reduced motion tih hi en la .

Entirna thenkhat nen popovers te hnathawh dan hriat duh chuan chhiar chhunzawm zel ang che.

Entirnan: Hmun tinah popovers enable rawh

Page pakhata popover zawng zawng initialize dan pakhat chu an data-toggleattribute hmanga thlan hi a ni ang:

$(function () {
  $('[data-toggle="popover"]').popover()
})

Entirnan: containerOption hmangin

Popover tibuaitu parent element-a style thenkhat i neih chuan, containerchu element chhungah chuan popover-a HTML chu a lang zawk theih nan custom i dah duh ang.

$(function () {
  $('.example-popover').popover({
    container: 'body'
  })
})

Entirna

<button type="button" class="btn btn-lg btn-danger" data-toggle="popover" title="Popover title" data-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>

Kawng pali

Option pali a awm a, chunglam, dinglam, hnuai lam, leh veilam aligned te an ni.

<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="top" data-content="Top popover">
  Popover on top
</button>
<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="right" data-content="Right popover">
  Popover on right
</button>
<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="bottom" data-content="Bottom popover">
  Popover on bottom
</button>
<button type="button" class="btn btn-secondary" data-container="body" data-toggle="popover" data-placement="left" data-content="Left popover">
  Popover on left
</button>

A hnuaia click leh hunah dismiss rawh

focusUser-in toggle element aia element dang a click leh hunah popovers chu dismiss turin trigger hmang ang che .

Dismiss-on-next-click atan markup bik a ngai

Cross-browser leh cross-platform behavior dik tak neih theih nan tag ni lovin tag i hmang tur a ni <a>a , attribute <button>pawh i dah tel tur a ni.tabindex

<a tabindex="0" class="btn btn-lg btn-danger" role="button" data-toggle="popover" data-trigger="focus" title="Dismissible popover" data-content="And here's some amazing content. It's very engaging. Right?">Dismissible popover</a>
$('.popover-dismiss').popover({
  trigger: 'focus'
})

Elements tihtawp a ni

Attribute nei element te disabledhi interactive an ni lo va, chu chu user te chuan popover (or tooltip) trigger turin hover emaw click emaw an ti thei lo tihna a ni. Workaround atan chuan wrapper atanga popover kha trigger <div>emaw , on the disabled element <span>override emaw i duh ang.pointer-events

Disabled popover triggers tan chuan i duh zawk thei bawk a, chutiang bawkin popover chu i hmangtute hnenah disabled element clickdata-trigger="hover" an beisei loh avangin visual feedback nghal ang maia lang turin i duh thei bawk.

<span class="d-inline-block" data-toggle="popover" data-content="Disabled popover">
  <button class="btn btn-primary" style="pointer-events: none;" type="button" disabled>Disabled button</button>
</span>

Hman dan tur

JavaScript hmangin popovers te chu enable rawh:

$('#example').popover(options)
GPU tih chakna a ni

Popovers hi Windows 10 device-ah chuan GPU acceleration leh system DPI siam danglam a nih avangin blurry takin a lang fo thin. v4 ah chuan hei hi a workaround chu i popovers ah a tul angin GPU acceleration disable hi a ni.

Fix tura rawtna:

Popper.Defaults.modifiers.computeStyle.gpuAcceleration = !(window.devicePixelRatio < 1.5 && /Win/.test(navigator.platform))

Keyboard leh assistive technology hmangtute tan popovers hnathawh tir

Keyboard hmangtute’n i popovers an activate theih nan, HTML elements, hmanlai keyboard-focusable leh interactive (link emaw form control ang chi)-ah chauh i dah tur a ni. Attribute dah belh hian arbitrary HTML elements ( <span>s ang chi) chu focusable-a siam theih ni mah se tabindex="0", hei hian keyboard hmangtute tan non-interactive element-a tab stop tibuaitu leh buaithlak tak tak a dah belh dawn a, tunah hian assistive technology tam zawk chuan hetiang dinhmunah hian popover-a thu awmte hi an puang lo . hoverTin, i popovers te tan trigger atan chauh rinchhan suh , hei hian keyboard hmangtute tan trigger theih loh a siam dawn avangin.

Popovers-ah hian htmloption hmangin rich, structured HTML i dah thei a, mahse, content tam lutuk dah loh turin kan fuih tak zet che a ni. Tuna popovers hnathawh dan chu, vawi khat a lan hnuah, an content chu aria-describedbyattribute nei trigger element nen an inzawm tlat a ni. Chumi avang chuan popover-a thu awm zawng zawng chu assistive technology hmangtute hnenah stream rei tak, tihtawp loh pakhat anga puan a ni ang.

Tin, i popover-ah hian interactive controls (form elements emaw links ang chi) te pawh telh theih a nih laiin (heng elements te hi whiteListor allowed attributes leh tags-ah te dahin), tunah chuan popover hian keyboard focus order a enkawl lo tih hre reng ang che. Keyboard hmangtuin popover a hawn chuan triggering element-ah focus a awm reng a, popover hian document structure-a trigger a zawm nghal loh tlangpui avangin hmalam pan/pressing tih theihna tur guarantee a awm loTABkeyboard hmangtu pakhat chu popover chhungah ngei a hruai lut ang. A tawi zawngin, popover-a interactive controls dah mai mai chuan heng control-te hi keyboard hmangtu leh assistive technology hmangtute tan chuan thlen theih loh/hman theih loh a nih a rinawm a, a tlem berah chuan overall focus order chu a dik lo hle mai thei bawk. Heng hunah hian modal dialog hman ai chuan ngaihtuah zawk ang che.

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-animation="".

Security avang hian sanitize, sanitizeFnleh whiteListoption te chu data attribute hmangin supply theih a ni lo tih hre reng ang che.
Hming Lampang Hlawhchhamna Hrilhfiahna
animation tih a ni boolean a ni dik Popover ah hian CSS fade transition hmangin apply rawh
container a ni string | element | diklo diklo

Popover chu element bik pakhatah a append thin. Entirnan: container: 'body'. He option hi a bik takin a tangkai hle a, triggering element bulah document flow-ah popover chu dah theih a ni - chu chuan window resize laiin popover chu triggering element atanga hla takah a float loh nan a veng ang.

lungawi string | element | thiltih '' tih a ni.

data-contentAttribute a awm loh chuan default content value a ni.

Function pek a nih chuan a thisreference set chu popover attached element-ah dahin a ko ang.

titlai number | thil 0 a ni

Popover (ms) entir leh thup hun sawn hlat - manual trigger type-ah a huam lo

Number supply a nih chuan hide/show pahnih ah delay a awm vek a ni

Thil awm dan tur chu:delay: { "show": 500, "hide": 100 }

html tih a ni boolean a ni diklo Popover ah chuan HTML kha dah lut rawh. False a nih chuan jQuery-a textmethod hmangin DOM-ah content dah a ni ang. XSS attack i ngaihtuah chuan text hmang rawh.
dahna tur hmun a ni string | thiltih 'dik'

Popover dah dan tur - auto | chunglam | hnuai lam | veilam | dik.
A autotarlan hunah chuan popover chu dynamically reorient a ni ang.

Function pakhat hmanga placement hriat chian a nih chuan popover DOM node chu a argument hmasa ber atan leh triggering element DOM node chu a pahnihna atan hmangin koh a ni. Context chu thispopover instance ah dah a ni.

selector a ni string | diklo diklo Selector pek a nih chuan popover objects chu target tarlan te hnenah delegate a ni ang. A taka hman chuan hei hi dynamic HTML content-a popovers dah theihna turin hman a ni. Hei hi leh entîrna thu hriat theihna en rawh .
template a ni hrui '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'

Popover siam huna hman tur HTML base rawh.

Popover's titlechu inject a ni ang a, .popover-header.

Popover's contentchu inject a ni ang a, .popover-body.

.arrowpopover-a arrow a lo ni ta a ni.

Wrapper element pawn lam ber chuan .popoverclass a nei tur a ni.

nihna string | element | thiltih '' tih a ni.

titleAttribute a awm loh chuan title value default a ni.

Function pek a nih chuan a thisreference set chu popover attached element-ah dahin a ko ang.

ti per hrui 'click' a ti a. Popover a tihchhuah dan - | hover rawh | focus | kuta thawh. Trigger tam tak i pass thei a; space hmangin then hran rawh. manualtrigger dang nen pawh a inzawm thei lo.
offset a ni number | hrui 0 a ni Popover chu a target nena khaikhin chuan offset a ni. Hriat belh duh chuan Popper-a offset docs en rawh.
fallbackPlacement tih a ni string | array a ni 'vai' Fallback-ah Popper hian eng position nge a hman dawn tih tarlan phalsak rawh. Hriat belh duh chuan Popper-a behavior docs en rawh
customClass a ni string | thiltih '' tih a ni.

Popover a lan hunah class te dah belh rawh. Template-a class tarlan zawng zawng bakah heng class te hi dah belh a ni ang tih hre reng ang che. Class tam tak dah belh tur chuan space hmangin then rawh: 'a b'.

Class hming dang awmna string pakhata rawn pe chhuak tur function pawh i pass thei bawk.

ramri a ni string | thil bul 'scrollParent' tih a ni. Overflow constraint ramri chu popover a ni. 'viewport', 'window', 'scrollParent', emaw HTMLElement reference (JavaScript chauh) value te a pawm . Hriat belh duh chuan Popper-a preventOverflow docs en rawh.
sanitize tih a ni boolean a ni dik Sanitization hi enable emaw disable emaw theih a ni. Activated a nih chuan 'template', 'content'leh 'title'options te chu sanitized a ni ang. Kan JavaScript documentation a sanitizer tih hi en la .
whiteList a ni thil Default value a ni Object ah chuan attribute leh tag phalsak te a awm
tihthianghlimFn null | thiltih engmah lo Hetah hian mahni sanitize function i supply thei ang. Sanitization tih nan library bik hman i duh chuan hei hi a tangkai thei hle.
popperConfig a ni null | thil engmah lo Bootstrap a default Popper config thlak tur chuan Popper configuration en la

Mimal popovers te tan data attribute te

Popover pakhat zel atana duhthlan tur chu a danglamna chu data attribute hmanga tarlan theih a ni a, a chunga kan sawi tawh ang khan.

Thiltih dan tur

Asynchronous method leh inthlak danglamna te

API method zawng zawng hi asynchronous a ni a , transition a tan vek a ni . Transition an tan veleh mahse a tawp hmain call tu hnenah an kir leh thin . Chu bakah, transitioning component-a method call chu ngaihthah a ni ang .

Hriat belh duh chuan kan JavaScript documentation en rawh .

$().popover(options)

Element collection pakhat atan popovers a initialize thin.

.popover('show')

Element pakhat popover a nihzia a pholang. Popover a lan tak tak hmain (chu chu shown.bs.popoverevent a thlen hmain) caller hnenah a kir leh thin. Hei hi popover “manual” triggering anga ngaih a ni. Popovers title leh content zero-length pahnih nei te chu an lang ngai lo.

$('#element').popover('show')

.popover('hide')

Element pakhat popover a thup. Popover chu thup tak tak a nih hmain (chu chu hidden.bs.popoverthilthleng a thlen hma) call tu hnenah a kir leh thin. Hei hi popover “manual” triggering anga ngaih a ni.

$('#element').popover('hide')

.popover('toggle')

Element pakhat popover a toggle thin. Popover a lan tak tak emaw a thup hma emaw (chu chu shown.bs.popoveror hidden.bs.popoverevent a thlen hma) caller hnenah a kir leh thin. Hei hi popover “manual” triggering anga ngaih a ni.

$('#element').popover('toggle')

.popover('dispose')

Element pakhat popover chu a thup a, a tichhe vek bawk. Delegation hmanga siam Popovers ( option hmanga siamselector ) te chu descendant trigger element-ah pakhat zel tihchhiat theih a ni lo.

$('#element').popover('dispose')

.popover('enable')

Element pakhat popover chu a lantir theihna a pe. Popovers hi default in enable a ni.

$('#element').popover('enable')

.popover('disable')

Element pakhat popover lantir theihna tur a paih chhuak. Popover hi re-enable a nih chauhvin a lantir theih dawn a ni.

$('#element').popover('disable')

.popover('toggleEnabled')

Element pakhat popover lantir emaw thup emaw theihna tur a toggles.

$('#element').popover('toggleEnabled')

.popover('update')

Element pakhat popover awmna hmun a update thin.

$('#element').popover('update')

Thil thlengte

Thil thleng chi hrang hrang Hrilhfiahna
show.bs.popover tih hi a ni showHe event hi instance method kan koh chuan a fire nghal vek a ni.
a lantir.bs.popover He event hi popover chu user hmuh theiha siam a nih hunah fire a ni (CSS transitions zawh hun a nghak ang).
thup.bs.popover tih hi a ni hideHe event hi instance method koh a nih chuan a fire nghal a ni.
thup.bs.retheihna He event hi popover chu user hnen atanga thup a nih zawh chuan fired a ni (CSS transitions zawh hun a nghak ang).
a rawn dah lut.bs.popover show.bs.popoverHe event hi DOM-a popover template dah a nih hunah event zawhah fired a ni.
$('#myPopover').on('hidden.bs.popover', function () {
  // do something...
})