JavaScript hmangin a rawn lang ang
jQuery-a siam kan optional JavaScript plugins hmangin Bootstrap chu nunna pe rawh. Plugin tin chungchang te, kan data leh programmatic API option te leh thil dang tam tak zir rawh.
Mimal emaw, khawlkhawm emaw a ni thei
Plugins chu pakhat zel hmangin (Bootstrap’s individual hmangin js/dist/*.js
), a nih loh leh vawi khatah hmang vek bootstrap.js
emaw, minified emaw hmangin bootstrap.min.js
(a pahnih hian telh loh tur) te pawh a tel thei bawk.
Bundler (Webpack, Rollup...) i hman chuan /js/dist/*.js
UMD ready file i hmang thei bawk.
Innghahna te
Plugin leh CSS component thenkhat chu plugin dang a innghat a ni. Plugin te chu pakhat zel i dah tel a nih chuan docs ah hian heng dependencies te hi check ngei ngei tur a ni. Tin, plugin zawng zawng hi jQuery ah an innghat tih hre bawk ang che (hei hian plugin files hmain jQuery hi a tel tur a ni tihna a ni). jQuery version eng ber nge support tih hriat duh chuan our hi zawt rawh .package.json
Kan dropdowns, popovers leh tooltips te pawh Popper.js ah a innghat bawk .
Data attribute te hi a ni
Bootstrap plugin zawng zawng deuhthaw hi HTML hmang chauhvin data attribute (JavaScript functionality hman dan kan duh ber) hmangin enable leh configure theih a ni. Element pakhatah data attribute set khat chauh hmang ngei ang che (eg, button pakhat atang hian tooltip leh modal i trigger thei lo.)
Mahse, dinhmun thenkhatah chuan he functionality hi tihtawp hi duhthusam a ni thei. Data attribute API disable tur chuan document namespace-a event awm zawng zawng chu hetiang hian unbind vek data-api
ang che:
A dang pawhin, plugin bik target tur chuan plugin hming chu namespace atan data-api namespace nen hetiang hian dah mai rawh:
Selector te pawh a awm
Tunah hian DOM elements zawhna tur chuan native methods kan hmang a querySelector
, querySelectorAll
performance vangin, chuvangin valid selectors hman a ngai a ni . Special selector i hman chuan, entirnan: collapse:Example
tlanbosan ngei ang che.
Thil thlengte
Bootstrap hian plugin tam zawkte thiltih danglam bik atan custom event a pe a. A tlangpuiin, hengte hi infinitive leh past participle form-ah an lo kal a - chutah chuan show
thilthleng pakhat tan tirh lamah infinitive (ex. ) chu a insiam a, a past participle form (ex. shown
) chu thiltih zawh hunah a insiam a ni.
Infinitive event zawng zawng hian preventDefault()
functionality an pe vek a. Hei hian action pakhat execution chu a tan hmaa tihtawp theihna a pe a ni. Event handler atanga false rawn thawn let pawhin automatic in a call ang preventDefault()
.
Programmatic API hmanga siam a ni
Tin, Bootstrap plugin zawng zawng hi JavaScript API hmang chauhvin i hmang thei tur a ni tih kan ring bawk. Public API zawng zawng hi single, chainable method a ni a, collection acted on chu a rawn pe kir vek a ni.
Method zawng zawng hian optional options object, method bik target tu string emaw, engmah (default behavior hmanga plugin initiate tu) emaw an pawm tur a ni:
Plugin tin hian an raw constructor chu Constructor
property pakhatah an expose bawk: $.fn.popover.Constructor
. Plugin instance bik i hmuh duh chuan element atanga direct-in la chhuak rawh: $('[rel="popover"]').data('popover')
.
Asynchronous function leh inthlak danglamna te
Programmatic API method zawng zawng hi asynchronous a ni a , transition tan a nih veleh a tawp hmain caller hnenah a kir leh thin .
Transition zawh veleh action execute tur chuan a inmil event chu i ngaithla thei ang.
Chu bakah transitioning component a method call chu ngaihthah a ni ang .
Settings hmasa ber a ni
Plugin pakhat tana default settings chu plugin Constructor.Default
object chu siam danglamin i thlak thei ang:
Inhnialna a awm lo
A chang chuan Bootstrap plugins te hi UI framework dang nen hman a ngai thin. Hetiang dinhmunah hian namespace collision a awm fo thin. Chutiang a nih chuan i .noConflict
value revert duh plugin chu i call thei ang.
Version number te pawh a awm
Bootstrap-a jQuery plugin pakhat zel version chu VERSION
plugin constructor property hmangin a lut thei a ni. Entirnan, tooltip plugin atan chuan:
JavaScript tihtawp a nih chuan special fallback a awm lo
Bootstrap-a plugins te hi JavaScript tihtawp a nih chuan a bik takin grace takin an tla leh lo. Hetiang a nih avang hian user experience i ngaih pawimawh a nih chuan, i user-te <noscript>
hnena thil awmdan (leh JavaScript re-enable dan tur) hrilhfiah nan hmang la, leh/ emaw, nangmah ngeiin i custom fallback te pawh add rawh.
Third-party library te pawh a awm bawk
Bootstrap hian official takin third-party JavaScript library Prototype emaw jQuery UI ang chi a support lo. Despite .noConflict
leh namespaced events, compatibility problem a awm thei a, chu chu nangmah ngeiin i siam that a ngai a ni.
Util
Bootstrap-a JavaScript file zawng zawng hi a innghat a, util.js
JavaScript file dangte nen a dah tel a ngai bawk. Compiled (or minified) i hmang a nih chuan bootstrap.js
hei hi dah tel a ngai lo—a awm tawh.
util.js
utility function leh transitionEnd
event hrang hrang atana basic helper bakah CSS transition emulator a awm bawk. Plugin dangte chuan CSS transition support a awm leh awm loh enfiah nan leh hanging transition man nan an hmang thin.