Etsa hore likarolo tsa Bootstrap li phele—hona joale ka li-plugins tse 13 tsa jQuery.
Li-plugins li ka kenyelletsoa ka bonngoe (le hoja ba bang ba hloka ho itšetleha), kapa kaofela hang-hang. Ka bobeli bootstrap.js le bootstrap.min.js li na le li-plugins tsohle faeleng e le 'ngoe.
U ka sebelisa li-plugins tsohle tsa Bootstrap feela ka har'a markup API ntle le ho ngola mola o le mong oa JavaScript. Ena ke API ea sehlopha sa pele sa Bootstrap 'me e lokela ho ba maikutlo a hau a pele ha u sebelisa plugin.
Ho boletse joalo, maemong a mang ho ka ba molemo ho tima ts'ebetso ena. Ka hona, re boetse re fana ka bokhoni ba ho tima API ea tšobotsi ea data ka ho lokolla liketsahalo tsohle tsa 'mele tse nang le `'data-api'`. Sena se shebahala tjena:
- $ ( 'mele' ). tima ( '.data-api' )
Ntle le moo, ho lebisa plugin e itseng, kenyelletsa feela lebitso la plugin joalo ka sebaka sa mabitso hammoho le sebaka sa mabitso sa data-api joalo ka:
- $ ( 'mele' ). tima ( '.alert.data-api' )
Hape re lumela hore o lokela ho sebelisa li-plugins tsohle tsa Bootstrap feela ka JavaScript API. Li-API tsohle tsa sechaba ke mekhoa e le 'ngoe, e ka tsamaisoang ka ketane, 'me e khutlisetsa pokello e sebelisitsoeng.
- $ ( ".btn.danger" ). konopo ( "toggle" ). addClass ( "mafura" )
Mekhoa eohle e lokela ho amohela ntho ea boikhethelo, khoele e lebisitseng mokhoa o itseng, kapa letho (e qalang plugin ka boits'oaro ba kamehla):
- $ ( "#myModal" ). modal () // E qadilwe ka tse sa fetoheng
- $ ( "#myModal" ). modal ({ keyboard : false }) // e qalisoa ntle le keyboard
- $ ( "#myModal" ). modal ( 'show' ) // E qala le ho kopa pontsho hanghang
Plugin e 'ngoe le e' ngoe e boetse e pepesa sehahi sa eona se tala thepa ea `Constructor`: $.fn.popover.Constructor
. Haeba u batla ho fumana mohlala o itseng oa plugin, e fumane ka kotloloho ho tsoa ho element: $('[rel=popover]').data('popover')
.
Ka linako tse ling hoa hlokahala ho sebelisa li-plugins tsa Bootstrap tse nang le meralo e meng ea UI. Maemong ana, ka linako tse ling ho ka ba le likhohlano tsa sebaka sa mabitso. Haeba sena se etsahala, u ka bitsa .noConflict
plugin u lakatsa ho khutlisetsa boleng ba.
- var bootstrapButton = $ . fn . konopo . noConflict () // khutlisetsa $.fn.button ho boleng bo fanoeng pele
- $ . fn . bootstrapBtn = bootstrapButton // fana ka $().bootstrapBtn tšebetso ea bootstrap
Bootstrap e fana ka liketsahalo tsa tloaelo bakeng sa liketso tse ngata tse ikhethang tsa plugin. Ka kakaretso, tsena li tla ka mokhoa o sa feleng le oa nako e fetileng - moo lentsoe le sa feleng (mohlala. show
) le qalisoang qalong ea ketsahalo, 'me sebopeho sa eona sa nako e fetileng (mohlala shown
.
Liketsahalo tsohle tse sa feleng li fana ka ts'ebetso ea preventDefault. Sena se fana ka bokhoni ba ho emisa ts'ebetso ea ketso pele e qala.
- $ ( '#MyModal' ). ho ( 'show' , mosebetsi ( e ) {
- haeba (! data ) khutlisetsa e . thibelaDefault () // Ho emisa modal ho bontshwa
- })
Bakeng sa liphello tse bonolo tsa phetoho, kenyelletsa bootstrap-transition.js hang hammoho le lifaele tse ling tsa JS. Haeba u sebelisa compiled (kapa minified) bootstrap.js , ha ho hlokahale hore u kenyelle sena-e se e ntse e le teng.
Mehlala e seng mekae ea transition plugin:
Li-modal li hlophisitsoe hantle, empa lia tenyetseha, likeletso tsa lipuisano tse nang le ts'ebetso e nyane e hlokahalang le mefokolo e bohlale.
Mokhoa o hlophisitsoeng o nang le hlooho, 'mele, le sete sa liketso botlaseng.
'Mele o le mong o motle ...
- <div class = "modal hide fade" >
- <div class = "modal-header" >
- <button type = "button" class = "close" data-dismiss = "modal" aria-hidden = "nete" > × </ konopo>
- <h3> Sehlooho sa Modal </h3>
- </ div>
- <div class = "modal-body" >
- <p> 'Mele o le mong o motle… </p>
- </ div>
- <div class = "modal-footer" >
- <a href = "#" class = "btn"> Koala </a> _
- <a href = "#" class = "btn btn-primary"> Boloka liphetoho </a>
- </ div>
- </ div>
Fetolela modal ka JavaScript ka ho tobetsa konopo e ka tlase. E tla thellela fatše ebe e nyamela ho tloha holimo leqepheng.
- <!-- Konope ya ho qala modal -->
- <a href = "#myModal" role = "button" class = "btn" data-toggle = "modal" > Hlakola mofuta wa demo </a>
- <!-- Modal -->
- <div id = "myModal" class = "modal hide fade" tabindex = "-1" role = "dialog" aria-labelledby = "myModalLabel" aria- hidden = "nete" >
- <div class = "modal-header" >
- < mofuta oa konopo = "button" class = "close" data-dismiss = "modal" aria-hidden = "nete" > × </button>
- <h3 id = "myModalLabel" > Hlooho ya Modal </h3>
- </ div>
- <div class = "modal-body" >
- <p> 'Mele o le mong o motle… </p>
- </ div>
- <div class = "modal-footer" >
- <button class = "btn" data-dismiss = "modal" aria-hidden = "nete" > Kwala </button>
- <button class = "btn btn-primary" > Boloka liphetoho </button>
- </ div>
- </ div>
Kenya modal ntle le ho ngola JavaScript. Beha data-toggle="modal"
karolo ea taolo, joalo ka konopo, hammoho le data-target="#foo"
kapa href="#foo"
ho shebisa mokhoa o itseng oa ho fetola.
- < mofuta oa konopo = "konopo" data-toggle = "modal" data-target = "#myModal" > Mokhoa oa ho qala </button>
Letsetsa modal ka id myModal
ka mola o le mong oa JavaScript:
- $ ( '#MyModal' ). modal ( likhetho )
Likhetho li ka fetisoa ka lintlha tsa data kapa JavaScript. Bakeng sa litšobotsi tsa data, kenya lebitso la khetho ho data-
, joalo ka data-backdrop=""
.
Lebitso | mofuta | ya kamehla | tlhaloso |
---|---|---|---|
bokamorao | boolean | 'nete | E kenyelletsa karolo ea modal-backdrop. Ntle le moo, hlakisa static boemo ba morao-rao bo sa koaheleng mokhoa oa ho tobetsa. |
keyboard | boolean | 'nete | E koala modal ha konopo ea escape e tobetsoa |
bontsha | boolean | 'nete | E bonts'a modal ha e qala. |
hole | tsela | bohata | Haeba url e hole e fanoe, litaba li tla kengoa ka
|
E kenya tšebetsong litaba tsa hau joalo ka mokhoa. E amohela khetho ea boikhethelo object
.
- $ ( '#MyModal' ). mokhoa ({
- keyboard : bohata
- })
E fetola modal ka letsoho.
- $ ( '#MyModal' ). modal ( 'toggle' )
E bula modal ka letsoho.
- $ ( '#MyModal' ). modal ( 'show' )
E pata modal ka letsoho.
- $ ( '#MyModal' ). modal ( 'hide' )
Sehlopha sa modal sa Bootstrap se pepesa liketsahalo tse 'maloa tsa ho hokahana le ts'ebetso ea modal.
Ketsahalo | Tlhaloso |
---|---|
bontsha | Ketsahalo ena e tuka hang hang ha show mokhoa oa mohlala o bitsoa. |
bontshitswe | Ketsahalo ena e ts'oaroa ha modal e entsoe hore e bonahale ho mosebelisi (e tla emela hore liphetoho tsa css li phethehe). |
pata | Ketsahalo ena e lelekoa hang hang ha hide mokhoa oa mohlala o bitsoa. |
patiloeng | Ketsahalo ena e ts'oaroa ha modal e qeta ho patoa ho mosebelisi (e tla emela hore liphetoho tsa css li phethehe). |
- $ ( '#MyModal' ). ho ( 'e patiloeng' , mosebetsi () {
- // etsa ntho e itseng...
- })
Kenya menyetla ea ho theoha hoo e batlang e le eng kapa eng ka plugin ena e bonolo, ho kenyeletsoa navbar, li-tab le lipilisi.
Kenya data-toggle="dropdown"
sehokelong kapa konopong ho totobetsa ho theoha.
- <div class = "dropdown" >
- <a class = "dropdown-toggle" data-toggle = "dropdown" href = "#" > Dropdown trigger </a>
- <ul class = "dropdown-menu" role = "menu" aria-labelledby = "dLabel" >
- ...
- </ul>
- </ div>
Ho boloka li-URL li sa fetohe, sebelisa data-target
tšobotsi ho e-na le href="#"
.
- <div class = "dropdown" >
- <a class = "dropdown-toggle" id = "dLabel" role = "button" data-toggle = "dropdown" data-target = "#" href = "/page.html" >
- Theosa
- <b sehlopha = "tlhokomelo" ></b>
- </a>
- <ul class = "dropdown-menu" role = "menu" aria-labelledby = "dLabel" >
- ...
- </ul>
- </ div>
Letsetsa li-dropdown ka JavaScript:
- $ ( '. dropdown-toggle' ). ho theoha ()
Ha ho letho
Lenaneo la api bakeng sa ho totoba menu bakeng sa navbar e fanoeng kapa navigation e nang le li-tabbed.
The ScrollSpy plugin ke ea ho inchafatsa lipheo tsa nav ka bo eona ho ipapisitse le boemo ba moqolo. Tsamaisetsa sebaka se ka tlase ho navbar 'me u shebelle phetoho ea sehlopha se sebetsang. Lintlha tse tlase li tla totobatsoa hape.
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi pele ba rekisa qui. Litokelo tsa libaesekele tsa polasi-to-tafola tsa Tumblr eng kapa eng. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui mohlomong ha u e-s'o utloe ka tsona et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork litelu. Litelu tsa Freegan aliqua cupidatat mcsweeney's vero. Cupidatat tse nne loko nisi, ea helvetica nulla carles. Lori ea lijo e nang le tattoo ea cosby sweater, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft biri motlatsi oa keytar deserunt.
Occaecat commodo aliqua deelectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS e ntlafalitse. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.
In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id guessnda. Locavore sed helvetica cliche irony, thundercats mohlomong ha u so utloe ka tsona consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat pele ba rekisa, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft biri seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.
Ho eketsa habonolo boitšoaro ba scrollspy ho navigation ea topbar ea hau, kenya feela nthong data-spy="scroll"
eo u batlang ho e hloela (haholo e tla ba 'mele) le data-target=".navbar"
ho khetha nav eo u ka e sebelisang. U tla batla ho sebelisa scrollspy e nang le .nav
karolo.
- <body data-spy = "scroll" data-target = ".navbar" > ... </body>
Letsetsa scrollspy ka JavaScript:
- $ ( '#navbar' ). scrollspy ()
<a href="#home">home</a>
tlameha ho lumellana le ntho e ka dom e kang
<div id="home"></div>
.
Ha o sebelisa scrollspy mmoho le ho eketsa kapa ho tlosa likarolo ho tsoa ho DOM, o tla hloka ho letsetsa mokhoa oa ho khatholla joalo ka:
- $ ( '[data-spy="scroll"]' ). e 'ngoe le e' ngoe ( mosebetsi () {
- var $ hloela = $ ( sena ). scrollspy ( 'refresh' )
- });
Likhetho li ka fetisoa ka lintlha tsa data kapa JavaScript. Bakeng sa litšobotsi tsa data, kenya lebitso la khetho ho data-
, joalo ka data-offset=""
.
Lebitso | mofuta | ya kamehla | tlhaloso |
---|---|---|---|
offset | palo | 10 | Lipikseli tsa ho theola ho tloha holimo ha ho baloa boemo ba ho tsamaisa. |
Ketsahalo | Tlhaloso |
---|---|
kenya tshebetsong | Ketsahalo ena e tuka neng kapa neng ha ntho e ncha e kentsoe tšebetsong ke scrollspy. |
Eketsa ts'ebetso ea li-tab e potlakileng, e matla ho fetela ka har'a liphasejene tsa litaba tsa lehae, esita le ka li-menu tse theohang.
Raw denim mohlomong ha u e-s'o utloe ka bona li-jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.
Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.
Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
Lumella li-tab tse ka khonehang ka JavaScript (tabo e 'ngoe le e' ngoe e hloka ho etsoa ka bonngoe):
- $ ( '#myTab a' ). tobetsa ( mosebetsi ( e ) {
- e . preventDefault ();
- $ ( sena ). tab ( 'show' );
- })
O ka kenya li-tab tsa motho ka mong ka litsela tse 'maloa:
- $ ( '#MyTab a[href="#profile"]' ). tab ( 'show' ); // Khetha tab ka mabitso
- $ ( '#myTab a:first' ). tab ( 'show' ); // Khetha tab ya pele
- $ ( '#myTab a:last' ). tab ( 'show' ); // Khetha tab ya ho qetela
- $ ( '#myTab li:eq(2) a' ). tab ( 'show' ); // Khetha tabo ea boraro (0-indexed)
O ka kenya ts'ebetso ea "tabo" kapa "pilisi" ntle le ho ngola JavaScript efe kapa efe ka ho hlakisa feela data-toggle="tab"
kapa data-toggle="pill"
ka ntho e itseng. Ho kenyelletsa nav
le nav-tabs
litlelase ho tab ho ul
tla sebelisa setaele sa tab ea Bootstrap.
- <ul class = "nav-tabs" >
- <li><a href = "#home" data-toggle = "tab"> Lehae </a></li >
- <li><a href = "#profile" data-toggle = "tab"> Boemo </a> </li>
- <li><a href = "#messages" data-toggle = "tab"> Melaetsa </a></li >
- <li><a href = "#settings" data-toggle = "tab"> Litlhophiso </a></li >
- </ul>
E kenya tshebetsong karolo ya tab le setshelo sa dikahare. Tab e lokela ho ba le node ea setshelo data-target
kapa e href
lebisitsoeng ho DOM.
- <ul class = "nav-tabs" id = "myTab" >
- <li class = "active" ><a href = "#home"> Lehae </a></li >
- <li><a href = "#profile"> Profile </a> </li>
- <li><a href = "#melaetsa"> Melaetsa </a> </li>
- <li><a href = "#settings"> Litlhophiso </a> </li>
- </ul>
- <div class = "tab-content" >
- <div class = "tab-pane e sebetsang" id = "hae" > ... </div>
- <div class = "tab-pane" id = "profile" > ... </div>
- <div class = "tab-pane" id = "melaetsa" > ... </div>
- <div class = "tab-pane" id = "settings" > ... </div>
- </ div>
- <script>
- $ ( mosebetsi () {
- $ ( '#myTab a:last' ). tab ( 'show' );
- })
- </script>
Ketsahalo | Tlhaloso |
---|---|
bontsha | Ketsahalo ena e qala ho bonts'a li-tab, empa pele tab e ncha e bontšoa. Sebelisa event.target le event.relatedTarget ho shebisa tab e sebetsang le tab e fetileng e sebetsang (haeba e le teng) ka ho latellana. |
bontshitswe | Ketsahalo ena e tla hlaha ka mor'a hore tab e hlahisoe. Sebelisa event.target le event.relatedTarget ho shebisa tab e sebetsang le tab e fetileng e sebetsang (haeba e le teng) ka ho latellana. |
- $ ( 'a[data-toggle="tab"]' ). ho ( 'e bontšitsoeng' , mosebetsi ( e ) {
- e . target // Letlapa le butsoeng
- e . amanangTarget // tab e fetileng
- })
E bululetsoe ke plugin e ntle haholo ea jQuery.tipsy e ngotsoeng ke Jason Frame; Litlhahiso ke mofuta o ntlafalitsoeng, o sa itšetleheng ka litšoantšo, sebelisa CSS3 bakeng sa lipopae, le litšobotsi tsa data bakeng sa polokelo ea lihlooho tsa lehae.
Ka mabaka a ts'ebetso, lisebelisoa le popover data-apis li khetha ho kena, ho bolelang hore u tlameha ho li qala ka bouena .
Tsamaea holim'a lihokelo tse ka tlase ho bona lintlha tsa lisebelisoa:
Borikhoe bo thata bo latelang keffiyeh mohlomong ha u so utloe ka bona. Photo booth litelu tse tala tsa denim letterpress vegan messenger bag stumptown. Seaparo sa polasi-to-tafola seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparse e na le terry richardson vinyl chambray. Litelu stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A really ironic artisan whatever keytar , scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.
Ha u sebelisa lithulusi le li-popovers ka lihlopha tsa ho kenya Bootstrap, u tla tlameha ho beha khetho container
(e ngotsoeng ka tlase) ho qoba litla-morao tse sa batleheng.
Qala sesebelisoa ka JavaScript:
- $ ( '#mohlala' ). tooltip ( likgetho )
Likhetho li ka fetisoa ka lintlha tsa data kapa JavaScript. Bakeng sa litšobotsi tsa data, kenya lebitso la khetho ho data-
, joalo ka data-animation=""
.
Lebitso | mofuta | ya kamehla | tlhaloso |
---|---|---|---|
animation | boolean | 'nete | sebelisa phetoho ea css fade ho tooltip |
html | boolean | bohata | Kenya html ntlheng ea lisebelisoa. Haeba e le leshano, mokhoa oa jquery text o tla sebelisoa ho kenya litaba ka har'a dom. Sebelisa mongolo haeba u tšoenyehile ka litlhaselo tsa XSS. |
ho beha | khoele | tshebetso | 'holimo' | mokhoa oa ho beha tooltip - top | tlase | le letšehali | hantle |
mokhethi | khoele | bohata | Haeba ho fanoe ka sekhetho, lintlha tsa lisebelisoa li tla abeloa lipehelo tse boletsoeng. |
sehlooho | khoele | tshebetso | '' | boleng ba sehlooho sa kamehla haeba tag ea `sehlooho` e le sieo |
qhoqhoa | khoele | 'hover focus' | hore na tooltip e qala joang - tobetsa | hloella | tsepamisa | tataiso. Ela hloko mohlala oa hau oa "case pass trigger" mutliple, sebaka se arohaneng, mefuta ea trigger. |
lieha | nomoro | ntho | 0 | tieho ho bonts'a le ho pata ntlha ea lisebelisoa (ms) - ha e sebetse mofuteng oa ho qala ka letsoho Haeba nomoro e fanoe, ho lieha ho sebelisoa ho pata/show ka bobeli Sebopeho sa ntho ke: |
setshelo | khoele | bohata | bohata | E kopanya ntlha ea lisebelisoa ho ntho e itseng |
- <a href = "#" data-toggle = "tooltip" title = "tooltip ea pele"> fetelletsa holim'a ka </a>
E hokela sebatli sa lithulusi pokellong ea lintho.
E senola karolo ea lisebelisoa.
- $ ( '#element' ). tooltip ( 'show' )
E pata ntlha ea lisebelisoa.
- $ ( '#element' ). tooltip ( 'hide' )
E fetola ntlha ea lisebelisoa.
- $ ( '#element' ). tooltip ( 'toggle' )
E pata le ho senya ntlha ea lisebelisoa.
- $ ( '#element' ). tooltip ( 'destroy' )
Eketsa likoahelo tse nyane tsa litaba, joalo ka tse ho iPad, ho karolo efe kapa efe bakeng sa tlhaiso-leseling ea bobeli ea matlo. Tsamaisa holim'a konopo ho qala popover. E hloka hore Tooltip e kenyeletsoe.
Ho na le likhetho tse 'nè: holimo, ho le letona, ka tlase, le ho le letšehali.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Ha ho lipapatso tse bonts'itsoeng joalo ka popover tse hlahisoang ho tsoa ho JavaScript le litaba tse ka har'a data
tšobotsi.
Lumella li-popover ka JavaScript:
- $ ( '#mohlala' ). popover ( likhetho )
Likhetho li ka fetisoa ka lintlha tsa data kapa JavaScript. Bakeng sa litšobotsi tsa data, kenya lebitso la khetho ho data-
, joalo ka data-animation=""
.
Lebitso | mofuta | ya kamehla | tlhaloso |
---|---|---|---|
animation | boolean | 'nete | sebelisa phetoho ea css fade ho tooltip |
html | boolean | bohata | Kenya html ho popover. Haeba e le leshano, mokhoa oa jquery text o tla sebelisoa ho kenya litaba ka har'a dom. Sebelisa mongolo haeba u tšoenyehile ka litlhaselo tsa XSS. |
ho beha | khoele | tshebetso | 'ho lokile' | mokhoa oa ho beha popover - holimo | tlase | le letšehali | hantle |
mokhethi | khoele | bohata | haeba ho fanoe ka khetho, lisebelisoa tsa lisebelisoa li tla abeloa lipehelo tse boletsoeng |
qhoqhoa | khoele | 'tobetsa' | hore na popover e qala joang - tobetsa | hloella | tsepamisa | tataiso |
sehlooho | khoele | tshebetso | '' | boleng ba sehlooho sa kamehla ha semelo sa `sehlooho` se le sieo |
dikahare | khoele | tshebetso | '' | boleng ba dikahare tsa kamehla haeba semelo sa `seteng sa data` se le sieo |
lieha | nomoro | ntho | 0 | tieho ho bonts'a le ho pata popover (ms) - ha e sebetse ho mofuta oa mochini oa ho qala Haeba nomoro e fanoe, ho lieha ho sebelisoa ho pata/show ka bobeli Sebopeho sa ntho ke: |
setshelo | khoele | bohata | bohata | E eketsa popover ho element e itseng |
Bakeng sa mabaka a ts'ebetso, Tooltip le Popover data-apis li khetha ho kena. Haeba u batla ho li sebelisa, bolela feela khetho ea khetho.
E qala popovers bakeng sa pokello ea lintho.
E senola sebopeho sa element.
- $ ( '#element' ). popover ( 'show' )
E pata li-element popover.
- $ ( '#element' ). popover ( 'hide' )
E fetola popo ea lintho.
- $ ( '#element' ). popover ( 'toggle' )
E pata le ho senya popover ea element.
- $ ( '#element' ). popover ( 'senya' )
Kenya ts'ebetso ea ho tlosa melaetsa eohle ea tlhokomeliso ka plugin ena.
Fetola sena le sane ebe o leka hape. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.
Lumella ho tlosoa ha tlhokomeliso ka JavaScript:
- $ ( ".alert" ). hlokomelisa ()
Kenya feela data-dismiss="alert"
konopo ea hau ea ho koala ho fana ka ts'ebetso e haufi ea tlhokomeliso.
- <a class = "close" data-dismiss = "alert" href = "#" > × </a>
E phuthela litlhokomeliso tsohle ka ts'ebetso e haufi. Ho etsa hore litemoso tsa hau li phele ha u koetsoe, etsa bonnete ba hore li se li ntse li sebelisoa .fade
le sehlopha..in
E koala tlhokomeliso.
- $ ( ".alert" ). tlhokomeliso ( 'close' )
Sehlopha sa tlhokomeliso sa Bootstrap se pepesa liketsahalo tse 'maloa bakeng sa ho hokahana le ts'ebetso ea tlhokomeliso.
Ketsahalo | Tlhaloso |
---|---|
koala | Ketsahalo ena e tuka hang hang ha close mokhoa oa mohlala o bitsoa. |
koaloa | Ketsahalo ena e etsoa ha tlhokomeliso e koetsoe (e tla emela hore liphetoho tsa css li phethehe). |
- $ ( '#temoso eaka' ). tlama ( 'koetsoe' , mosebetsi () {
- // etsa ntho e itseng...
- })
Fumana mekhoa ea motheo le tšehetso e feto-fetohang bakeng sa likarolo tse putlamang joalo ka li-accordion le navigation.
* E hloka hore plugin ea Transitions e kenyeletsoe.
Re sebelisa plugin ea ho putlama, re thehile widget e bonolo ea setaele sa accordion:
- <div class = "accordion" id = "accordion2" >
- <div sehlopha = "sehlopha sa accordion" >
- <div class = "accordion-heading" >
- <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseOne"> _
- Ntho e Kopantsoeng ea Sehlopha #1
- </a>
- </ div>
- <div id = "collapseOne" class = "accordion-body collapse in" >
- <div class = "accordion-inner" >
- Anim pariatur cliche...
- </ div>
- </ div>
- </ div>
- <div sehlopha = "sehlopha sa accordion" >
- <div class = "accordion-heading" >
- <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseTwo"> _
- Ntho ea #2 e Kolohang ea Sehlopha
- </a>
- </ div>
- <div id = "collapseTwo" class = "accordion-body collapse" >
- <div class = "accordion-inner" >
- Anim pariatur cliche...
- </ div>
- </ div>
- </ div>
- </ div>
- ...
U ka sebelisa plugin ntle le letšoao la accordion. Etsa konopo ho fetola ho hola le ho putlama ha elemente e 'ngoe.
- < mofuta oa konopo = "button" class = "btn btn-danger" data-toggle = "collapse" data-target = "#demo" >
- e phuthoang e bonolo
- </ konopo>
- <div id = "demo" class = "collapse in" > … </div>
Kenya feela data-toggle="collapse"
le data-target
ho element ho abela taolo ea ntho e putlahang. Tšobotsi e amohela khetho ea data-target
css eo u ka sebelisang ho putlama ho eona. Etsa bonnete ba hore o kenyelletsa sehlopha collapse
ho ntho e putlang. Haeba u rata hore e bulehe ka mokhoa o tloaelehileng, eketsa sehlopha sa tlatsetso in
.
Ho kenya taolo ea sehlopha se kang accordion taolong e putlang, eketsa tšobotsi ea data data-parent="#selector"
. Sheba demo ho bona sena se sebetsa.
Lumella ka letsoho ka:
- $ ( ".collapse" ). putlama ()
Likhetho li ka fetisoa ka lintlha tsa data kapa JavaScript. Bakeng sa litšobotsi tsa data, kenya lebitso la khetho ho data-
, joalo ka data-parent=""
.
Lebitso | mofuta | ya kamehla | tlhaloso |
---|---|---|---|
motsoadi | mokhethi | bohata | Haeba sekhethi se tla koaleha, likarolo tsohle tse ka putlamang tlas'a motsoali ea boletsoeng li tla koaloa ha ntho ena e bonohang e bontšoa. (e ts'oanang le boitšoaro ba moetlo oa accordion) |
toggle | boolean | 'nete | E fetola ntho e ka putlamang kopong |
E kenya tšebetsong litaba tsa hau joalo ka ntho e ka putlamang. E amohela khetho ea boikhethelo object
.
- $ ( '#myCollapsible' ). ho putlama ({
- toggle : bohata
- })
E fetolela ntho e putlahang hore e bontšoe kapa e patiloe.
E bonts'a ntho e putlahang.
E pata ntho e putlang.
Sehlopha sa ho putlama sa Bootstrap se pepesa liketsahalo tse 'maloa bakeng sa ho hokahana le ts'ebetso ea ho putlama.
Ketsahalo | Tlhaloso |
---|---|
bontsha | Ketsahalo ena e tuka hang hang ha show mokhoa oa mohlala o bitsoa. |
bontshitswe | Ketsahalo ena e ts'oaroa ha karolo e putlamang e bonahalitsoe ho mosebelisi (e tla emela hore liphetoho tsa css li phethehe). |
pata | Ketsahalo ena e lelekoa hang-hang ha hide mokhoa o bitsoa. |
patiloeng | Ketsahalo ena e ts'oaroa ha karolo ea ho putlama e patetsoe mosebelisi (e tla emela hore liphetoho tsa css li phethehe). |
- $ ( '#myCollapsible' ). ho ( 'e patiloeng' , mosebetsi () {
- // etsa ntho e itseng...
- })
Setšoantšo sa li-slide se ka tlase se bontša plugin e akaretsang le karolo ea ho palama libaesekele ho pholletsa le likarolo tse kang carousel.
- <div id = "myCarousel" sehlopha = "carousel slide" >
- <ol sehlopha = "carousel-indicators" >
- <li data-target = "#myCarousel" data-slide-to = "0" class = "active" ></li>
- <li data-target = "#myCarousel" data-slide-to = "1" ></li>
- <li data-target = "#myCarousel" data-slide-to = "2" ></li>
- </ol>
- <!-- Lintho tsa Carousel -->
- <div sehlopha = "carousel-inner" >
- <div class = "ntho e sebetsang" > ... </div>
- <div class = "ntho" > ... </div>
- <div class = "ntho" > ... </div>
- </ div>
- <!-- Carousel nav -->
- <a class = "carousel-control left" href = "#myCarousel" data-slide = "prev"> & lsaquo ; </a>
- <a class = "carousel-control right" href = "#myCarousel" data-slide = "e latelang" > › </a>
- </ div>
Sebelisa litšobotsi tsa data ho laola boemo ba carousel habonolo. data-slide
e amohela mantsoe a sehlooho prev
kapa next
, e fetolang boemo ba slide ho ipapisitsoe le boemo ba hona joale. Ntle le moo, sebelisa data-slide-to
ho fetisa index ea li-slide tse tala ho carousel data-slide-to="2"
, e leng boemo ba li-slide ho index e itseng e qalang ka 0
.
Letsetsa carousel ka letsoho ka:
- $ ( '.carousel' ). carousel ()
Likhetho li ka fetisoa ka likarolo tsa data kapa JavaScriptz. Bakeng sa litšobotsi tsa data, kenya lebitso la khetho ho data-
, joalo ka data-interval=""
.
Lebitso | mofuta | ya kamehla | tlhaloso |
---|---|---|---|
karohano | palo | 5000 | Nako ea ho lieha pakeng tsa ho palama ntho ka bo eona. Haeba e le leshano, carousel e ke ke ea potoloha ka bo eona. |
kgefutsa | khoele | "tsamaea" | E emisa ho palama baesekele ho mouseenter mme e qalella ho palama baesekele ea carousel holim'a mouseleave. |
E qala carousel ka khetho ea boikhethelo object
ebe e qala ho palama lintho.
- $ ( '.carousel' ). carousel ({
- nako : 2000
- })
E potoloha ka har'a lintho tsa carousel ho tloha ho le letšehali ho ea ho le letona.
E emisa carousel ho palama baesekele ka har'a lintho.
E potoloha carousel ho foreime e itseng (0 e thehiloeng, e ts'oanang le lethathamo).
Lipotoloho ho ea nthong e fetileng.
Lipotoloho ho ea nthong e latelang.
Sehlopha sa carousel sa Bootstrap se pepesa liketsahalo tse peli tsa ho hokahana le ts'ebetso ea carousel.
Ketsahalo | Tlhaloso |
---|---|
thella | Ketsahalo ena e tuka hang hang ha slide mokhoa oa mohlala o sebelisoa. |
thella | Ketsahalo ena e thunngoa ha carousel e phethela phetoho ea eona ea li-slide. |
Plugin ea mantlha, e atolositsoeng habonolo bakeng sa ho theha kapele li-typeheads tse ntle ka mokhoa ofe kapa ofe oa mongolo.
- <input type = "text" data- provide = "typeahead" >
U tla batla ho seta autocomplete="off"
ho thibela li-menu tsa sebatli tsa kamehla hore li se ke tsa hlaha holim'a ho theoha ha sehlooho sa Bootstrap.
Eketsa litšobotsi tsa data ho ngolisa ntho e nang le ts'ebetso ea typeahead joalokaha ho bontšitsoe mohlaleng o ka holimo.
Letsetsa mochine oa khatiso ka letsoho ka:
- $ ( '.typeahead' ). mofuta oa pele ()
Likhetho li ka fetisoa ka lintlha tsa data kapa JavaScript. Bakeng sa litšobotsi tsa data, kenya lebitso la khetho ho data-
, joalo ka data-source=""
.
Lebitso | mofuta | ya kamehla | tlhaloso |
---|---|---|---|
mohlodi | array, tshebetso | [ ] | Mohloli oa data oa ho botsa khahlano le. E ka ba letoto la likhoele kapa tšebetso. Ts'ebetso e fetisitsoe likhang tse peli, query boleng sebakeng sa ho kenya le process callback. Ts'ebetso e ka sebelisoa ka mokhoa o ts'oanang ka ho khutlisa mohloli oa data ka kotloloho kapa ka mokhoa process o lumellanang ka khang e le 'ngoe ea callback. |
lintho | palo | 8 | Nomoro e phahameng haholo ea lintho tse tla hlahisoa ho dropdown. |
minLength | palo | 1 | Bonyane bolelele ba litlhaku tse hlokahalang pele o kenya litlhahiso tsa ho qetela |
matcher | tshebetso | ho hloka kutlo | Mokhoa o sebelisoang ho fumana hore na potso e lumellana le ntho e itseng. E amohela khang e le 'ngoe, item eo ho eona ho lekang potso. Fumana seo u se batlang ka this.query . Khutlisetsa boolean true haeba potso e lumellana. |
hlopha | tshebetso | ntho e nyallanang hantle, e nyenyefatsang taba, ha e na kutlo |
Mokhoa o sebelisitsoeng ho hlophisa liphetho tsa ho qetela. E amohela khang e le 'ngoe' items me e na le boholo ba mohlala oa typeahead. Sheba potso ea hajoale ka this.query . |
montlafatsi | tshebetso | e khutlisetsa ntho e khethiloeng | Mokhoa o sebelisoang ho khutlisa ntho e khethiloeng. E amohela khang e le 'ngoe, ' item me e na le boholo ba mohlala oa typeahead. |
e totobatsang | tshebetso | e totobatsa litšoaneleho tsohle tsa kamehla | Mokhoa o sebelisitsoeng ho totobatsa liphetho tsa ho qetela. E amohela khang e le 'ngoe' item me e na le boholo ba mohlala oa typeahead. E lokela ho khutlisa html. |
E qala ho kenya letsoho ka ho ngola pele.
Subnavigation e ka letsohong le letšehali ke demo e phelang ea plugin ea affix.
Ho eketsa habonolo boitšoaro ba affix ho ntho efe kapa efe, eketsa feela data-spy="affix"
ntho eo u batlang ho e hloela. Ebe u sebelisa li-offsets ho hlalosa nako ea ho kenya le ho tima ho penya ha element.
- <div data-spy = "affix" data-offset-top = "200" > ... </div>
affix
,
affix-top
, le
affix-bottom
. Hopola ho shebana le motsoali ea nang le monyetla oa ho putlama ha affix e kenella ha e ntse e tlosa litaba ho tsoa ho phallo e tloaelehileng ea leqephe.
Letsetsa plugin ea affix ka JavaScript:
- $ ( '#navbar' ). khomaretsa ()
Likhetho li ka fetisoa ka lintlha tsa data kapa JavaScript. Bakeng sa litšobotsi tsa data, kenya lebitso la khetho ho data-
, joalo ka data-offset-top="200"
.
Lebitso | mofuta | ya kamehla | tlhaloso |
---|---|---|---|
offset | nomoro | tshebetso | ntho | 10 | Lipikselse tsa ho theola skrineng ha ho baloa hore na sebaka sa moqolo ke sefe. Haeba ho fanoe ka nomoro e le 'ngoe, offset e tla sebelisoa ka litsela tse peli tse holimo le tse ka ho le letšehali. Ho mamela tataiso e le 'ngoe, kapa li-offsets tse ngata tse ikhethang, fana ka ntho feela offset: { x: 10 } . Sebelisa ts'ebetso ha o hloka ho fana ka offset (e molemo bakeng sa meralo e meng e arabelang). |