Kawo abubuwan haɗin Bootstrap zuwa rai-yanzu tare da al'ada 13 jQuery plugins.
Ana iya haɗa plugins daban-daban (ko da yake wasu suna buƙatar abin dogaro), ko gaba ɗaya. Duka bootstrap.js da bootstrap.min.js sun ƙunshi duk plugins a cikin fayil ɗaya.
Kuna iya amfani da duk Bootstrap plugins zalla ta hanyar API ɗin alama ba tare da rubuta layi ɗaya na JavaScript ba. Wannan shine API ɗin aji na farko na Bootstrap kuma yakamata ya zama abin lura na farko lokacin amfani da plugin.
Wannan ya ce, a wasu yanayi yana iya zama kyawawa a kashe wannan aikin. Sabili da haka, muna kuma ba da ikon musaki sifa ta API ta hanyar cire duk abubuwan da suka faru akan sunan jikin da aka ware tare da ''data-api''. Wannan yayi kama da haka:
- $ ( 'jiki' ). kashe ( '.data-api' )
A madadin, don ƙaddamar da takamaiman plugin ɗin, kawai haɗa sunan plugin ɗin azaman sarari suna tare da bayanan-api sunaye kamar haka:
- $ ( 'jiki' ). kashe ( '.alert.data-api' )
Mun kuma yi imanin ya kamata ku iya amfani da duk abubuwan Bootstrap kawai ta JavaScript API. Duk APIs na jama'a guda ɗaya ne, hanyoyin da za a iya sarƙa, da dawo da tarin da aka yi aiki da su.
- $ ( ".btn.danger" ). button ( "juyawa" ). addClass ( "mai" )
Duk hanyoyin ya kamata su karɓi zaɓin zaɓi na zaɓi, kirtani wanda ke nufin wata hanya, ko ba komai (wanda ke fara plugin ɗin tare da halayen tsoho):
- $ ( "#myModal" ). modal () // an fara shi tare da ɓatanci
- $ ( "#myModal" ). modal ({allon madannai : ƙarya }) // an fara shi ba tare da keyboard ba
- $ ( "#myModal" ). modal ( 'show' ) // farawa da kiran nuni nan da nan
Kowane plugin kuma yana fallasa ɗanyen ginin sa akan kayan 'Constructor': $.fn.popover.Constructor
. Idan kuna son samun misalan plugin ɗin, dawo da shi kai tsaye daga wani abu: $('[rel=popover]').data('popover')
.
Wani lokaci yana da mahimmanci a yi amfani da plugins Bootstrap tare da wasu tsarin UI. A cikin waɗannan yanayi, karon sararin samaniya na iya faruwa lokaci-lokaci. Idan wannan ya faru, kuna iya kiran .noConflict
plugin ɗin da kuke son mayar da darajar.
- var bootstrapButton = $ . fn . maballin . noConflict () // mayar da maɓallin $.fn. zuwa ƙimar da aka sanya a baya
- $ . fn . bootstrapBtn = bootstrapButton // bada $() .bootstrapBtn aikin bootstrap
Bootstrap yana ba da al'amuran al'ada don yawancin ayyukan plugins na musamman. Gabaɗaya, waɗannan suna zuwa ne a cikin sigar ɓarna mai ƙarewa kuma ta wuce - inda ƙarshen (misali show
) ke haifar da shi a farkon wani lamari, kuma sigar ɓangarorin sa na baya (misali shown
) yana haifar da ƙarshen aikin.
Duk abubuwan da ba su da iyaka suna ba da aikin hana tsoho. Wannan yana ba da ikon dakatar da aiwatar da wani aiki kafin ya fara.
- $ ( '#myModal' ). kan ( 'nuna' , aiki ( e ) {
- idan (! data ) dawo e . hanaDefault () // yana dakatar da nunawa
- })
Don sauƙaƙan tasirin canji, haɗa da bootstrap-transition.js sau ɗaya tare da sauran fayilolin JS. Idan kana amfani da harhada (ko rage) bootstrap.js , babu buƙatar haɗa wannan - ya riga ya kasance.
Misalai kaɗan na plugin ɗin canji:
Modals an daidaita su, amma masu sassauƙa, maganganun tattaunawa tare da mafi ƙarancin aikin da ake buƙata da kuma rashin daidaituwa.
Modal da aka yi tare da kai, jiki, da saitin ayyuka a cikin ƙafar ƙafa.
Jiki mai kyau…
- <div class = "modal hide fade" >
- <div class = "modal-header" >
- < nau'in maballin = "button" class = "kusa" data-dismiss = "modal" aria-hidden = "gaskiya" > × </button>
- <h3> Modal header </h3>
- </div>
- <div class = "modal-body" >
- <p> Jiki mai kyau… </p>
- </div>
- <div class = "modal-footer" >
- <a href = "#" class = "btn"> Rufe </a> _
- <a href = "#" class = "btn btn-primary" > Ajiye canje-canje </a>
- </div>
- </div>
Juya modal ta JavaScript ta danna maɓallin da ke ƙasa. Zai zame ƙasa ya dushe daga saman shafin.
- <!-- Maballin don kunna modal -->
- <a href = "#myModal" role = "button" class = "btn" data-toggle = "modal" > Kaddamar da modal demo </a>
- <!-- Modal -->
- <div id = "myModal" class = "modal boye fade" tabindex = "-1" rawar = "dialog" aria-labeledby = "myModalLabel" aria-hidden = "gaskiya" >
- <div class = "modal-header" >
- <button type = "button" class = "rufe" data-dismiss = "modal" aria-hidden = "gaskiya" > × </button>
- <h3 id = "myModalLabel" > Modal header </h3>
- </div>
- <div class = "modal-body" >
- <p> Jiki mai kyau… </p>
- </div>
- <div class = "modal-footer" >
- <button class = "btn" data-dismiss = "modal" aria-hidden = "gaskiya" > Rufe </button>
- <button class = "btn btn-primary" > Ajiye canje-canje </button>
- </div>
- </div>
Kunna modal ba tare da rubuta JavaScript ba. Saita data-toggle="modal"
a kan abin sarrafawa, kamar maɓalli, tare da data-target="#foo"
ko href="#foo"
don ƙaddamar da takamaiman tsari don juyawa.
- <button type = "button" data-toggle = "modal" data-target = "#myModal" > Kaddamar da modal </button>
Kira modal tare da id myModal
tare da layi ɗaya na JavaScript:
- $ ( '#myModal' ). modal ( zaɓi )
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-backdrop=""
.
Suna | nau'in | tsoho | bayanin |
---|---|---|---|
baya | boolean | gaskiya | Ya ƙunshi nau'in modal-backdrop. A madadin, saka static don bayanan baya wanda baya rufe tsarin a dannawa. |
keyboard | boolean | gaskiya | Yana rufe tsarin lokacin da aka danna maɓallin guduwa |
nuna | boolean | gaskiya | Yana nuna tsarin lokacin farawa. |
m | hanya | karya | Idan an samar da url mai nisa, za a loda abun ciki ta hanyar jQuery
|
Yana kunna abun cikin ku azaman tsari. Yana yarda da zaɓin zaɓi object
.
- $ ( '#myModal' ). modal ({
- keyboard : karya
- })
Da hannu yana jujjuya modal.
- $ ( '#myModal' ). modal ( 'juyawa' )
Da hannu yana buɗe modal.
- $ ( '#myModal' ). modal ( 'show' )
Da hannu yana ɓoye modal.
- $ ( '#myModal' ). modal ( 'boye' )
Ajin modal na Bootstrap yana fallasa ƴan abubuwan da suka faru don haɗawa cikin ayyukan modal.
Lamarin | Bayani |
---|---|
nuna | Wannan taron yana gobara nan da nan lokacin da show aka kira hanyar misali. |
nunawa | Ana korar wannan taron lokacin da aka bayyana yanayin ga mai amfani (zai jira canjin css don kammala). |
boye | Ana korar wannan taron nan da nan lokacin da hide aka kira hanyar misali. |
boye | Ana korar wannan taron lokacin da tsarin ya gama ɓoyewa daga mai amfani (zai jira canjin css don kammala). |
- $ ( '#myModal' ). akan ( 'boye' , aiki () {
- // yi wani abu…
- })
Ƙara menu na zaɓuka zuwa kusan komai tare da wannan plugin ɗin mai sauƙi, gami da navbar, shafuka, da kwayoyi.
Ƙara data-toggle="dropdown"
zuwa hanyar haɗi ko maɓalli don kunna zazzagewa.
- <div class = "saukarwa" >
- <a class = "dropdown-toggle" data-toggle = "saukarwa" href = "#" > Fasakarwa </a>
- <ul class = "zaɓi-menu" rawar = "menu" aria-labeledby = "dLabel" >
- ...
- </ul>
- </div>
Don kiyaye URLs daidai, yi amfani da data-target
sifa maimakon href="#"
.
- <div class = "saukarwa" >
- <a class = "dropdown-toggle" id = "dLabel" rawar = "button" data-toggle = "saukarwa" data-target = "#" href = "/page.html" >
- Zazzagewa
- <b class = "kulawa" </b>
- </a>
- <ul class = "zaɓi-menu" rawar = "menu" aria-labeledby = "dLabel" >
- ...
- </ul>
- </div>
Kira zazzagewar ta hanyar JavaScript:
- $ ( '. dropdown-toggle' ). zazzagewa ()
Babu
API ɗin shirye-shirye don juyawa menus don abin da aka bayar na navbar ko kewayawa ta shafi.
The ScrollSpy plugin shine don sabunta makasudin nav ta atomatik dangane da matsayin gungurawa. Gungura wurin da ke ƙasa da maɓallin kewayawa kuma duba canjin aji mai aiki. Za a kuma haskaka ƙananan abubuwan da aka zazzage su ma.
Ad leggings keytar, brunch id art party dolor laborre. Pitchfork yr enim lo-fi kafin su sayar da qui. Tumblr gona-zuwa tebur haƙƙin keke komai. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby suwaita lomo Jean shorts, williamsburg hoodie minim qui mai yiwuwa ba ku ji labarin su ba da cardigan Trust fund culpa biodiesel wes anderson aesthetical. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Veniam marfa gashin baki skateboard, adipisicing fugiat velit pitchfork gemu. Freegan gemu aliqua cupidatat mcsweeney's vero. Cupidatat guda huɗu loko nisi, da helvetica nulla carles. Tattooed cosby sweater truck abinci, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles ba kayan motsa jiki ba yana buƙatar kulawa. Brooklyn adipisicing craft giya mataimakin keytar desrunt.
Occaecat commodo aliqua delectus. Fap craft giya deserunt skateboard ea. Haƙƙin keke na Lomo adipisicing banh mi, velit ea sunt next level locavore kofi mai asali guda a magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS yana da matukar damuwa. Consectetur nisi DIY minim jakar jaka. Cred ex in, dorewa delectus consectetur fanny fakitin 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 jakar marfa duk abin da motar abinci ta delectus. Sapiente synth id zatonnda. Locavore sed helvetica cliche irony, tsawa mai yiwuwa ba ku ji labarin su ba sakamakon hoodie gluten-free lo-fi fap aliquip. Labour elit placeat kafin su sayar da su, Terry Richardson proident brunch nesciunt quis cosby suweter pariatur keffiyeh ut helvetica artisan. Cardigan craft giya seitan readymade velit. VHS chambray labs na dan lokaci veniam. Anim mollit minim commodo ullamco thundercats.
Don sauƙin ƙara halayyar scrollspy zuwa kewayawar saman saman ku, kawai ƙara data-spy="scroll"
zuwa ɓangaren da kuke son yin rahõto a kai (mafi yawanci wannan zai zama jiki) kuma data-target=".navbar"
don zaɓar wanne nav don amfani. Kuna so ku yi amfani da scrollspy tare da .nav
sashi.
- <body data-spy = "scroll" data-target = ".navbar" > ... </body>
Kira scrollspy ta JavaScript:
- $ ( '#navbar' ). scrollspy ()
<a href="#home">home</a>
dole ne ya dace da wani abu a cikin gidan kamar
<div id="home"></div>
.
Lokacin amfani da scrollspy tare da ƙara ko cire abubuwa daga DOM, kuna buƙatar kiran hanyar wartsakewa kamar haka:
- $ ( '[data-leken asiri = " gungura"]' ). kowane ( aiki () {
- var $ Spy = $ ( wannan ). scrollspy ( 'refresh' )
- });
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-offset=""
.
Suna | nau'in | tsoho | bayanin |
---|---|---|---|
biya diyya | lamba | 10 | Pixels don kashewa daga sama yayin ƙididdige matsayi na gungurawa. |
Lamarin | Bayani |
---|---|
kunna | Wannan taron yana ƙonewa a duk lokacin da sabon abu ya kunna ta scrollspy. |
Ƙara aikin shafin mai sauri, mai ƙarfi don canzawa ta cikin fakitin abun ciki na gida, har ma ta menu na zazzagewa.
Raw denim mai yiwuwa ba ku ji labarin su jeans shorts Austin ba. Nesciunt tofu stumptown aliqua, retro synth master cleanse. gashin baki cliche tempor, williamsburg carles vegan helvetica. Reprehenderit mahauci retro keffiyeh dreamcatcher synth. Cosby suwaita eu banh mi, qui irure terry richardson ex squid. Yadda ake yin salvia cillum iphone. Seitan aliquip quis cardigan Amurka tufafi, mahauta 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 kafin su sayar da master cleanse gluten-free squid scenester freegan cosby sweater. Fanny fakitin Portland seitan DIY, liyafa na fasaha locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi kafin su sayar da gona-zuwa tebur VHS viral locavore cosby suwaita. Lomo wolf viral, gashin baki readymade thundercats keffiyeh craft giya marfa xa'a. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
Kunna shafukan da za a iya amfani da su ta hanyar JavaScript (kowane shafin yana buƙatar kunna shi daban):
- $ ( '#myTab a' ). danna ( aikin ( e ) {
- e . default ();
- $ ( wannan ). tab ( 'show' );
- })
Kuna iya kunna shafuka guda ɗaya ta hanyoyi da yawa:
- $ ( '#myTab a[href="#profile"]' ). tab ( 'show' ); // Zaɓi shafin da suna
- $ ( '#myTab a: farko' ). tab ( 'show' ); // Zaɓi shafin farko
- $ ( '#myTab a: karshe' ). tab ( 'show' ); // Zaɓi shafin ƙarshe
- $ ( '#myTab li:eq(2) a' ). tab ( 'show' ); // Zaɓi shafin na uku (0-indexed)
Kuna iya kunna shafi ko kewayawa kwaya ba tare da rubuta kowane JavaScript ba ta hanyar tantancewa kawai data-toggle="tab"
ko data-toggle="pill"
akan wani abu. Ƙara nav
da nav-tabs
azuzuwan zuwa shafin ul
zai yi amfani da salo na Bootstrap.
- <ul class = "nav nav-tabs" >
- <li><a href = "#home" data-toggle = "tab" > Gida </a></li>
- <li><a href = "#profile" data-toggle = "tab" > Bayanan martaba </a></li>
- <li><a href = "#messages" data-toggle = "tab" > Saƙonni </a></li>
- <li><a href = "#settings" data-toggle = "tab" > Saituna </a></li>
- </ul>
Yana kunna abun shafi da kwandon abun ciki. Tab ya kamata ya kasance yana da ko dai data-target
ko wani href
kumburin kwantena mai niyya a cikin DOM.
- <ul class = "nav nav-tabs" id = "myTab" >
- <li class = "active" ><a href = "#gida" > Gida </a></li>
- <li><a href = "#profile" > Bayanan martaba </a></li>
- <li><a href = "#messages" > Saƙonni </a></li>
- <li><a href = "#Settings" > Saituna </a></li>
- </ul>
- <div class = "tab-content" >
- <div class = "tab-pane active" id = "gida" > ... </div>
- <div class = "tab-pane" id = "profile" > ... </div>
- <div class = "tab-pane" id = "saƙonni" > ... </div>
- <div class = "tab-pane" id = "saituna" > ... </div>
- </div>
- <rubutu>
- $ ( aiki () {
- $ ( '#myTab a: karshe' ). tab ( 'show' );
- })
- </script>
Lamarin | Bayani |
---|---|
nuna | Wannan taron yana gobara akan nunin shafin, amma kafin a nuna sabon shafin. Yi amfani event.target da event.relatedTarget niyya shafi mai aiki da shafin da ya gabata (idan akwai) bi da bi. |
nunawa | Wannan taron yana gobara akan nunin shafin bayan an nuna shafin. Yi amfani event.target da event.relatedTarget niyya shafi mai aiki da shafin da ya gabata (idan akwai) bi da bi. |
- $ ( 'a[data-toggle = "tab"]' ). akan ( 'an nuna' , aiki ( e ) {
- e . manufa // kunna tab
- e . relatedTarget // shafi na baya
- })
Ƙaddamar da kyakkyawan jQuery.tipsy plugin wanda Jason Frame ya rubuta; Tukwici kayan aiki sigar da aka sabunta ne, waɗanda ba su dogara da hotuna ba, amfani da CSS3 don rayarwa, da sifofin bayanai don ajiyar take na gida.
Don dalilan aiki, kayan aiki da bayanan popover-apis sun shiga, ma'ana dole ne ka fara su da kanka .
Tsallake kan hanyoyin da ke ƙasa don ganin kayan aiki:
Tattara wando next level keffiyeh kila ba ki ji labarin su ba. Hoton hoton gemu raw denim wasiƙar vegan messenger jakar stumptown. Farm-to-tebur seitan, mcsweeney's fixie mai dorewa quinoa 8-bit tufafin Amurka suna da terry Richardson vinyl chambray. Gemu stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, hudu loko mcsweeney's tsabtace vegan chambray. A really ironic artisan whatever keytar , scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin kofi viral.
Lokacin amfani da tukwici na kayan aiki da popovers tare da ƙungiyoyin shigar da Bootstrap, dole ne ku saita container
zaɓin (rubutun ƙasa) don guje wa illolin da ba'a so.
Ƙaddamar da kayan aiki ta hanyar JavaScript:
- $ ( '#misali' ). kayan aiki ( zaɓi )
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-animation=""
.
Suna | nau'in | tsoho | bayanin |
---|---|---|---|
tashin hankali | boolean | gaskiya | Yi amfani da canjin css fade zuwa tip ɗin kayan aiki |
html | boolean | karya | Saka html a cikin kayan aiki. Idan ƙarya, za a yi amfani da hanyar jquery text don saka abun ciki a cikin gidan. Yi amfani da rubutu idan kun damu da harin XSS. |
jeri | zaren | aiki | ' saman' | yadda ake sanya kayan aiki - saman | kasa | hagu | dama |
mai zaɓe | kirtani | karya | Idan an samar da mai zaɓe, za a ba da abubuwan da suka shafi kayan aiki zuwa takamaiman maƙasudai. |
take | zaren | aiki | '' | Tsohuwar darajar take idan alamar ` take` ba ta nan |
jawo | kirtani | 'Hover focus' | yadda ake kunna kayan aiki - danna | shawa | mayar da hankali | manual. Lura cewa yanayin wucewa yana haifar da mutliple, sararin samaniya, nau'ikan fararwa. |
jinkiri | lamba | abu | 0 | jinkirin nunawa da ɓoye kayan aiki (ms) - baya aiki ga nau'in faɗakarwa na hannu Idan an ba da lamba, ana amfani da jinkiri ga duka ɓoye/nunawa Tsarin abu shine: |
ganga | zaren | karya | karya | Yana haɗa tip ɗin kayan aiki zuwa takamaiman yanki |
- <a href = "#" data-toggle = "tooltip" take = "farkon kayan aiki" > shawagi a kaina </a>
Haɗa mai sarrafa kayan aiki zuwa tarin abubuwa.
Yana bayyana tushen kayan aiki.
- $ ( '# element' ). kayan aiki ( 'show' )
Yana ɓoye bayanan kayan aiki.
- $ ( '# element' ). kayan aiki ( 'boye' )
Yana jujjuya matakin kayan aiki.
- $ ( '# element' ). Tooltip ( 'canzawa' )
Yana ɓoyewa da lalata kayan aikin wani abu.
- $ ( '# element' ). kayan aiki ( 'lalata' )
Ƙara ƙarami mai rufi na abun ciki, kamar waɗanda ke kan iPad, zuwa kowane nau'i na bayanan sakandare na gidaje. Juya kan maɓallin don kunna popover. Yana buƙatar haɗa Tushen kayan aiki .
Akwai zaɓuɓɓuka huɗu: saman, dama, ƙasa, da hagu masu layi.
Sed posuere consectetur est a lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est a lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est a lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est a lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Babu alamar da aka nuna kamar yadda aka samar da popovers daga JavaScript da abun ciki a cikin data
sifa.
Kunna popovers ta JavaScript:
- $ ( '#misali' ). popover ( zaɓi )
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-animation=""
.
Suna | nau'in | tsoho | bayanin |
---|---|---|---|
tashin hankali | boolean | gaskiya | Yi amfani da canjin css fade zuwa tip ɗin kayan aiki |
html | boolean | karya | Saka html a cikin popover. Idan ƙarya, za a yi amfani da hanyar jquery text don saka abun ciki a cikin gidan. Yi amfani da rubutu idan kun damu da harin XSS. |
jeri | zaren | aiki | 'dama' | yadda ake sanya popover - top | kasa | hagu | dama |
mai zaɓe | kirtani | karya | idan an samar da mai zaɓe, za a ba da abubuwan da suka shafi kayan aiki zuwa ga takamaiman maƙasudin |
jawo | kirtani | 'danna' | yadda popover ke jawo - danna | shawa | mayar da hankali | manual |
take | zaren | aiki | '' | Tsohuwar darajar take idan sifa ' take' ba ta nan |
abun ciki | zaren | aiki | '' | Tsohuwar ƙimar abun ciki idan 'abun cikin bayanai' ba ya kasancewa |
jinkiri | lamba | abu | 0 | jinkirin nunawa da ɓoye popover (ms) - baya shafi nau'in fararwa na hannu Idan an ba da lamba, ana amfani da jinkiri ga duka ɓoye/nunawa Tsarin abu shine: |
ganga | zaren | karya | karya | Haɗa popover zuwa takamaiman yanki |
Don dalilan aiki, Tooltip da Popover data-apis sun shiga ciki. Idan kuna son amfani da su kawai saka zaɓin zaɓi.
Yana farawa popovers don tarin abubuwa.
Yana bayyanar da abubuwa masu tasowa.
- $ ( '# element' ). popover ( 'show' )
Yana ɓoye abubuwan haɓakawa.
- $ ( '# element' ). popover ( 'boye' )
Yana jujjuya abubuwan haɓakawa.
- $ ( '# element' ). popover ( 'canzawa' )
Yana ɓoyewa da lalata faɗuwar wani abu.
- $ ( '# element' ). popover ( 'lalata' )
Ƙara aikin korar zuwa duk saƙonnin faɗakarwa tare da wannan plugin ɗin.
Canza wannan da wancan kuma a sake gwadawa. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras Mattis consectetur purus zauna amet fermentum.
Kunna korar faɗakarwa ta hanyar JavaScript:
- $ ( "jijjiga" ). faɗakarwa ()
Kawai ƙara data-dismiss="alert"
zuwa maɓallin ku don ba da aikin kusa da faɗakarwa ta atomatik.
- <a class = "close" data-dismiss = "alert" href = "#" > × </a>
Yana tattara duk faɗakarwa tare da ayyuka na kusa. Don faɗakarwar ku ta raye lokacin rufewa, tabbatar cewa an riga an yi amfani .fade
da .in
ajin da ajin.
Yana rufe faɗakarwa.
- $ ( "jijjiga" ). faɗakarwa ( 'kusa' )
Ajin faɗakarwa na Bootstrap yana fallasa ƴan abubuwan da suka faru don haɗawa cikin ayyukan faɗakarwa.
Lamarin | Bayani |
---|---|
kusa | Wannan taron yana gobara nan da nan lokacin da close aka kira hanyar misali. |
rufe | Ana kunna wannan taron lokacin da aka rufe faɗakarwa (zai jira canjin css don kammala). |
- $ ( '#ajiya na' ). ɗaure ( 'rufe' , aiki () {
- // yi wani abu…
- })
Sami salon tushe da sassauƙan tallafi don abubuwan haɗin gwiwa masu rugujewa kamar accordions da kewayawa.
* Yana buƙatar plugin ɗin Transition don haɗawa.
Yin amfani da plugin ɗin rushewa, mun gina widget ɗin salon accordion mai sauƙi:
- <div class = "accordion" id = "accordion2" >
- <div class = "kungiyar accordion" >
- <div class = "accordion-heading" >
- <a class = "accordion-toggle" data-toggle = "rushe" data-parent = "#accordion2" href = "#collapseOne" >
- Rukunin Rukuni na #1
- </a>
- </div>
- <div id = "collapseOne" class = "accordion-body rushe in" >
- <div class = "accordion-inner" >
- Anim pariatur cliche...
- </div>
- </div>
- </div>
- <div class = "kungiyar accordion" >
- <div class = "accordion-heading" >
- <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseTwo" >
- Abun Rukuni na #2
- </a>
- </div>
- <div id = "collapseTwo" class = "accordion-body rushe" >
- <div class = "accordion-inner" >
- Anim pariatur cliche...
- </div>
- </div>
- </div>
- </div>
- ...
Hakanan zaka iya amfani da plugin ɗin ba tare da alamar accordion ba. Yi maɓalli don jujjuya faɗaɗawa da rushewar wani abu.
- <button type = "button" class = "btn btn-danger" data-toggle = "collapse" data-target = "#demo" >
- sauki rugujewa
- </button>
- <div id = "demo" class = "rushewa" > … </div>
Kawai ƙara data-toggle="collapse"
da kuma data-target
zuwa kashi don ba da ikon sarrafa abin da zai iya rugujewa ta atomatik. Siffar data-target
tana karɓar mai zaɓin css don amfani da rushewar zuwa. Tabbatar ƙara ajin collapse
zuwa kashi mai rugujewa. Idan kuna son buɗewa ta tsohuwa, ƙara ƙarin ajin in
.
Don ƙara gudanarwar rukuni-kamar accordion zuwa sarrafawa mai yuwuwa, ƙara sifa na bayanai data-parent="#selector"
. Koma zuwa demo don ganin wannan a aikace.
Kunna da hannu tare da:
- $ ( ".rushe" ). rugujewa ()
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-parent=""
.
Suna | nau'in | tsoho | bayanin |
---|---|---|---|
iyaye | mai zaɓe | karya | Idan mai zaɓi to duk abubuwan da za su iya haɗuwa a ƙarƙashin ƙayyadadden iyaye za a rufe su lokacin da aka nuna wannan abu mai yuwuwa. (mai kama da dabi'un gargajiya na gargajiya) |
juya | boolean | gaskiya | Yana kunna abin da zai iya rushewa akan kira |
Yana kunna abun cikin ku azaman abun da zai iya rugujewa. Yana yarda da zaɓin zaɓi object
.
- $ ( '#myCollapsible' ). rugujewa ({
- juya : karya
- })
Yana juya wani abu mai rugujewa zuwa nunawa ko ɓoye.
Yana nuna kashi mai rugujewa.
Yana ɓoye wani abu mai rugujewa.
Ajin rushewar Bootstrap yana fallasa ƴan abubuwan da suka faru don haɗawa cikin ayyukan rugujewa.
Lamarin | Bayani |
---|---|
nuna | Wannan taron yana gobara nan da nan lokacin da show aka kira hanyar misali. |
nunawa | Ana korar wannan taron lokacin da aka bayyana ɓangaren rugujewa ga mai amfani (zai jira canjin css ya kammala). |
boye | Ana korar wannan taron nan da nan lokacin da hide aka kira hanyar. |
boye | Ana kora wannan taron lokacin da aka ɓoye ɓoyayyiyar ɓarna daga mai amfani (zai jira canjin css don kammala). |
- $ ( '#myCollapsible' ). akan ( 'boye' , aiki () {
- // yi wani abu…
- })
Nunin nunin faifan bidiyo da ke ƙasa yana nuna filogi na gabaɗaya da kuma bangaren yin keke ta hanyar abubuwa kamar carousel.
- <div id = "myCarousel" class = "carousel slide" >
- <ol class = "manufofin carousel" >
- <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>
- <!-- Abubuwan Carousel -->
- <div class = "carousel-inner" >
- <div class = "abu mai aiki" > … </div>
- <div class = "abu" > … </div>
- <div class = "abu" > … </div>
- </div>
- <!-- Carousel nav -->
- <a class = "carousel-control hagu" href = "#myCarousel" data-slide = "prev" > ‹ </a>
- <a class = "carousel-control right" href = "#myCarousel" data-slide = "na gaba" > & rsaquo; </a>
- </div>
Yi amfani da sifofin bayanai don sarrafa matsayin carousel cikin sauƙi. data-slide
yana karɓar kalmomin maɓalli prev
ko next
, wanda ke canza matsayi na faifai dangane da matsayinsa na yanzu. A madadin, yi amfani data-slide-to
da don ƙaddamar da ɗanyen fihirisar zamewa zuwa carousel data-slide-to="2"
, wanda ke tsalle matsayi na nunin zuwa wani fihirisar farawa da 0
.
Kira carousel da hannu tare da:
- $ ( '.carousel' ). carousel ()
Za a iya wuce zaɓuɓɓuka ta hanyar halayen bayanai ko JavaScriptz. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-interval=""
.
Suna | nau'in | tsoho | bayanin |
---|---|---|---|
tazara | lamba | 5000 | Adadin lokacin jinkirta tsakanin yin keke ta atomatik abu. Idan karya, carousel ba zai sake zagayawa ta atomatik ba. |
dakatarwa | kirtani | "tsayawa" | Yana dakatar da hawan keke na carousel akan linzamin linzamin kwamfuta kuma ya ci gaba da hawan keke na carousel a kan tafin linzamin kwamfuta. |
Ya fara carousel tare da zaɓin zaɓi object
kuma ya fara hawan keke ta abubuwa.
- $ ( '.carousel' ). carousel ({
- tazara : 2000
- })
Yana zagayawa cikin abubuwan carousel daga hagu zuwa dama.
Yana dakatar da carousel daga yin keke ta cikin abubuwa.
Yana zagayawa carousel zuwa wani firam na musamman (0 tushen, kama da tsararru).
Kewaya zuwa abu na baya.
Kewaya zuwa abu na gaba.
Ajin carousel na Bootstrap yana fallasa abubuwa biyu don haɗawa cikin ayyukan carousel.
Lamarin | Bayani |
---|---|
zamewa | Wannan taron yana buɗewa nan da nan lokacin da slide aka kira hanyar misali. |
zamiya | Ana korar wannan taron lokacin da carousel ya gama ƙaddamar da zamewar sa. |
Ainihin plugin ɗin mai sauƙi mai sauƙi don ƙirƙirar ƙayatattun rubutun rubutu tare da kowane nau'i na shigar da rubutu.
- < nau'in shigarwa = "rubutu" data- provide = "typehead" >
Za ku so a saita autocomplete="off"
don hana tsoffin menu na burauza daga bayyana a kan zazzagewar nau'in Bootstrap.
Ƙara sifofin bayanai don yin rajistar wani kashi mai aikin nau'in rubutu kamar yadda aka nuna a misalin da ke sama.
Kira typeahead da hannu tare da:
- $ ( '.typehead' ). irin ()
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-source=""
.
Suna | nau'in | tsoho | bayanin |
---|---|---|---|
tushe | tsararru, aiki | [] | Tushen bayanan don tambaya akan. Yana iya zama tsararrun igiyoyi ko aiki. An ƙetare aikin gardama biyu, query ƙima a cikin filin shigarwa da process dawowar kira. Ana iya amfani da aikin tare da haɗin gwiwa ta hanyar mayar da tushen bayanai kai tsaye ko a daidaita ta ta hanyar process hujja guda ɗaya ta dawo da kira. |
abubuwa | lamba | 8 | Matsakaicin adadin abubuwan da za a nuna a cikin zaɓuka. |
Tsawon min | lamba | 1 | Matsakaicin tsayin halayen da ake buƙata kafin fara aiwatar da shawarwarin cikawa ta atomatik |
mai daidaitawa | aiki | yanayin rashin jin daɗi | Hanyar da ake amfani da ita don tantance idan tambaya ta dace da abu. Ya yarda da hujja guda ɗaya, item wacce za a gwada tambayar. Samun damar tambayar yanzu tare da this.query . Koma boolean true idan tambaya ta dace. |
mai rarrabawa | aiki | daidai wasa, yanayin yanayi, yanayin rashin jin daɗi |
Hanyar da ake amfani da ita don warware sakamakon da aka kammala ta atomatik. Ya yarda da hujja guda ɗaya items kuma yana da iyakar misalin nau'in rubutu. Yi magana da tambayar yanzu tare da this.query . |
updater | aiki | yana dawo da abin da aka zaɓa | Hanyar da ake amfani da ita don dawo da abin da aka zaɓa. Ya yarda da hujja guda ɗaya, item kuma yana da iyakar misalin nau'in rubutu. |
mai haskakawa | aiki | yana haskaka duk tsoffin matches | Hanyar da aka yi amfani da ita don haskaka sakamakon da aka kammala ta atomatik. Ya yarda da hujja guda ɗaya item kuma yana da iyakar misalin nau'in rubutu. Ya kamata a dawo da html. |
Yana fara shigarwa tare da nau'in rubutu.
Ƙarƙashin kewayawa na hagu shine nunin nunin rayayye na affix plugin.
Don ƙara ɗabi'ar affix cikin sauƙi zuwa kowane nau'in, kawai ƙara data-spy="affix"
zuwa ɓangaren da kuke son yin leken asiri. Sannan yi amfani da kashe-kashe don ayyana lokacin kunna kunnawa da kashewa.
- <div data-spy = "affix" data-offset-top = "200" > ... </div>
affix
,
affix-top
, da
affix-bottom
. Ka tuna don bincika iyaye mai yuwuwar rugujewa lokacin da alamar ta shiga yayin da take cire abun ciki daga gudana na yau da kullun na shafin.
Kira plugin ɗin affix ta JavaScript:
- $ ( '#navbar' ). lika ()
Za a iya wucewa ta hanyar sifofin bayanai ko JavaScript. Don halayen bayanai, saka sunan zaɓin zuwa data-
, kamar a cikin data-offset-top="200"
.
Suna | nau'in | tsoho | bayanin |
---|---|---|---|
biya diyya | lamba | aiki | abu | 10 | Pixels don kashewa daga allo lokacin ƙididdige matsayi na gungurawa. Idan an samar da lamba ɗaya, za a yi amfani da kashewa a duka sama da hagu. Don sauraron jagora guda ɗaya, ko maɓalli na musamman, kawai samar da wani abu offset: { x: 10 } . Yi amfani da aiki lokacin da kuke buƙatar samar da koma baya (mai amfani ga wasu ƙira masu amsawa). |