Whakaorangia nga waahanga o Bootstrap-inaianei me nga taputapu jQuery ritenga 13.
Ka taea te whakauru takitahi nga monomai (ahakoa e hiahia ana etahi ki te whakawhirinaki), me te katoa i te wa kotahi. Kei roto i nga bootstrap.js me bootstrap.min.js nga monomai katoa i roto i te konae kotahi.
Ka taea e koe te whakamahi i nga taputapu Bootstrap katoa ma te tohu tohu API me te kore e tuhi i tetahi rarangi JavaScript. Koinei te API karaehe tuatahi a Bootstrap a me whakaaro tuatahi koe ina whakamahi ana i te mono.
E ai ki tera, i etahi ahuatanga ka pai ki te whakaweto i tenei mahi. Na reira, ka tukuna ano e matou te kaha ki te whakakore i te API huanga raraunga ma te wetewete i nga huihuinga katoa i runga i te ingoa o te tinana kua tohua ki te `'data-api'`. Ko te ahua tenei:
- $ ( 'tinana' ). weto ( '.data-api' )
Hei taapiri, ki te aro ki tetahi mono motuhake, whakauruhia te ingoa o te mono hei mokowāingoa me te mokowāingoa raraunga-api penei:
- $ ( 'tinana' ). weto ( '.alert.data-api' )
E whakapono ana matou ka taea e koe te whakamahi i nga taputapu Bootstrap katoa ma te JavaScript API. Ko nga API whanui katoa he tikanga kotahi, ka taea te mekameka, ka whakahoki i te kohinga i mahia.
- $ ( ".btn.danger" ). pātene ( "takahuri" ). addClass ( "ngako" )
Ko nga tikanga katoa me whakaae ki tetahi ahanoa kōwhiringa, he aho e aro ana ki tetahi tikanga, kaore ranei (e timata ana i te mono me te whanonga taunoa):
- $ ( "#myModal" ). modal () // kua arawhiti me nga taunoa
- $ ( "#myModal" ). modal ({ papapātuhi : teka }) // i arawhiti me te kore papapātuhi
- $ ( "#myModal" ). modal ( 'whakaatu' ) // arawhiti me te karanga whakaatu tonu
Ka whakaatu hoki ia mono i tana kaihanga mata ki runga i tetahi taonga `Constructor`: $.fn.popover.Constructor
. Mena kei te pirangi koe ki te tiki i tetahi tauira mono, tiki tika mai i tetahi huānga: $('[rel=popover]').data('popover')
.
I etahi wa ka tika te whakamahi i nga taputapu Bootstrap me etahi atu angamahi UI. I roto i enei ahuatanga, ka taea e nga tukinga mokowā ingoa i etahi wa. Mena ka pa mai tenei, ka waea atu koe .noConflict
ki te mono e hiahia ana koe ki te whakahoki i te uara o.
- var bootstrapButton = $ . fn . pātene . noConflict () // whakahokia te $.fn.button ki te uara kua whakaritea i mua
- $ . fn . bootstrapBtn = bootstrapButton // hoatu $().bootstrapBtn te mahi bootstrap
Ka whakaratohia e Bootstrap nga huihuinga ritenga mo te nuinga o nga mahi ahurei a te mono. Ko te tikanga, ka puta mai enei i roto i te ahua infinitive me te puka participle o mua - kei reira te infinitive (ex. show
) ka puta i te tiimatanga o te huihuinga, me tana puka participle o mua (ex. shown
) ka puta i te otinga o te mahi.
Ko nga takahanga mutunga kore ka whakarato i te mahi aukatiTaunoa. Ma tenei ka taea te aukati i te mahi i mua i te tiimata.
- $ ( '#myModal' ). kei runga ( 'whakaatu' , mahi ( e ) {
- ki te hoki mai ( ! raraunga ) e . preventDefault () // ka mutu te whakaatu i te tikanga
- })
Mo nga paanga whakawhiti ngawari, whakaurua bootstrap-transition.js kotahi ki te taha o etahi atu konae JS. Mena kei te whakamahi koe i te bootstrap.js kua whakaemihia (me iti ranei) , kaore he take ki te whakauru i tenei—kei kona ano.
Ko etahi tauira o te mono whakawhiti:
Ko nga tauira he mea whakamaarama, engari he ngawari, he korero akiaki me te iti rawa o nga mahi e hiahiatia ana me nga taunoa atamai.
He tikanga tuku me te pane, te tinana, me te huinga hohenga kei te hiku.
Kotahi te tinana pai…
- <div class = "Modal hide fade" >
- <div class = "modal-header" >
- <button type = "button" class = "close" data-dismiss = "modal" aria-huna = "pono" > &wa; </pātene>
- <h3> pane pane </h3>
- </div>
- <div class = "modal-body" >
- <p> Kotahi te tinana pai… </p>
- </div>
- <div class = "modal-footer" >
- <a href = "#" class = "btn" > Katia </a>
- <a href = "#" class = "btn btn-primary" > Tiakina nga huringa </a>
- </div>
- </div>
Takahurihia he tikanga ma te JavaScript ma te paatene i te paatene kei raro nei. Ka paheke ki raro ka memeha mai i te tihi o te wharangi.
- <!-- Patene hei whakaoho i te tikanga -->
- <a href = "#myModal" role = "button" class = "btn" data-toggle = "modal" > Whakarewahia te aratau demo </a>
- <!-- Modal -->
- <div id = "myModal" class = "Modal hide fade" tabindex = "-1" role = "dialog" aria-labelledby = "myModalLabel" aria-huna = "pono" >
- <div class = "modal-header" >
- <button type = "button" class = "close" data-dismiss = "modal" aria-hidden = "pono" > × </button>
- <h3 id = "myModalLabel" > pane pane </h3>
- </div>
- <div class = "modal-body" >
- <p> Kotahi te tinana pai… </p>
- </div>
- <div class = "modal-footer" >
- <button class = "btn" data-dismiss = "modal" aria-hidden = "pono" > Katia </button>
- <button class = "btn btn-primary" > Tiakina nga huringa </button>
- </div>
- </div>
Whakahohehia he tikanga me te kore e tuhi JavaScript. Whakatakotoria data-toggle="modal"
ki runga i te huānga mana whakahaere, penei i te paatene, me te, ki te whai data-target="#foo"
ranei href="#foo"
i tetahi aratau motuhake hei takahuri.
- <button type = "button" data-toggle = "modal" data-target = "#myModal" > Whakarewa tikanga </button>
Karangahia he tikanga me te id myModal
me te rarangi kotahi o JavaScript:
- $ ( '#myModal' ). modal ( kōwhiringa )
Ko nga whiringa ka taea te tuku ma nga huanga raraunga, JavaScript ranei. Mo nga huanga raraunga, apitihia te ingoa whiringa ki data-
, penei i te data-backdrop=""
.
Ingoa | momo | taunoa | whakaahuatanga |
---|---|---|---|
papamuri | boolean | pono | Kei roto he huānga tauira-papamuri. Arā, whakawhāitihia static he papamuri e kore e kati i te aratau i runga i te paatene. |
papapātuhi | boolean | pono | Ka kati i te aratau ina pehia te ki mawhiti |
whakaatu | boolean | pono | Ka whakaatu i te aratau ina arawhiti. |
mamao | ara | teka | Mena ka tukuna he url mamao, ka utaina nga ihirangi ma te
|
Whakahohehia to ihirangi hei aratau. Ka whakaae ki nga whiringa whiriwhiri object
.
- $ ( '#myModal' ). tikanga ({
- papapātuhi : teka
- })
Ka takahuri-a-ringa i te tikanga.
- $ ( '#myModal' ). modal ( 'takahuri' )
Ka whakatuwhera a-ringa i te tikanga.
- $ ( '#myModal' ). modal ( 'whakaatu' )
Ka huna a-ringa i tetahi tikanga.
- $ ( '#myModal' ). modal ( 'huna' )
Ko te karaehe aratau a Bootstrap e whakaatu ana i etahi huihuinga mo te hono atu ki nga mahi tikanga.
Takahanga | Whakaahuatanga |
---|---|
whakaatu | Ka pupuhi tenei takahanga ina ka show karangahia te aratuka tauira. |
whakaaturia | Ka puhia tenei takahanga i te wa i kitea ai te aratau ki te kaiwhakamahi (ka tatari kia oti nga whakawhitinga css). |
huna | Ka puhia tonutia tenei takahanga ina hide kua karangahia te aratuka tauira. |
huna | Ka puhia tenei takahanga ina mutu te hunanga o te tikanga mai i te kaiwhakamahi (ka tatari kia oti nga whakawhitinga css). |
- $ ( '#myModal' ). kei runga ( 'huna' , mahi () {
- // mahia tetahi mea…
- })
Taapirihia nga tahua takaiho ki nga mea katoa me tenei mono ngawari, tae atu ki te pae whakatere, ripa, me nga pire.
Tāpirihia data-toggle="dropdown"
ki tētahi hono, pātene rānei hei takahuri i te takaiho.
- <div class = "whakaheke" >
- <a class = "dropdown-toggle" data-toggle = "dropdown" href = "#" > Whakataka keu </a>
- <ul class = "tahua-whakaheke" role = "tahua" aria-labelledby = "dTapanga" >
- ...
- </ul>
- </div>
Kia mau tonu nga URL, whakamahia te data-target
huanga hei utu href="#"
.
- <div class = "whakaheke" >
- <a class = "dropdown-toggle" id = "dTapanga" role = "button" data-toggle = "dropdown" data-target = "#" href = "/page.html" >
- Whakataka iho
- <b class = "caret" ></b>
- </a>
- <ul class = "tahua-whakaheke" role = "tahua" aria-labelledby = "dTapanga" >
- ...
- </ul>
- </div>
Karangatia nga takaiho ma te JavaScript:
- $ ( '.dropdown-toggle' ). takaiho ()
Karekau
He api hotaka mo te takahuri i nga tahua mo tetahi pae whakaterenga, whakatere ripa ranei.
Ko te mono ScrollSpy mo te whakahou aunoa i nga whaainga nav i runga i te tuunga panuku. Panuku i te waahi kei raro i te pae whakatere ka mataki i te huringa o te karaehe hohe. Ka miramirahia nga mea iti takaiho.
Ad leggings keytar, brunch id toi party dolor laboure. Pitchfork yr enim lo-fi i mua i to ratou hoko atu. Tumblr pāmu-ki-tepu mana pahikara ahakoa. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Ko nga tarau tarau jean koti, williamsburg hoodie minim qui kaore pea koe i rongo mo ena me te cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artistan ullamco consequat.
Veniam marfa mustache papareti, adipisicing fugiat velit pitchfork pahau. Freegan pahau aliqua cupidatat mcsweeney's vero. Cupidatat wha loko nisi, ea helvetica nulla carles. Taraka kai taraka kai moko, ko te quis non freegan vinyl a mcsweeney. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.
Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Te mana paihikara Lomo 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. Ko te Vero VHS he tino pai. Consectetur etahi DIY iti putea karere. Ko te whakaaro o mua i roto i te, tauwhiro 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 ahakoa he taraka kai. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats kaore pea koe i rongo mo ratou e consequat hoodie gluten-free lo-fi fap aliquip. Whakamahia he waahi i mua i te hokonga atu, ko terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artistan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.
Kia ngawari te taapiri i te whanonga scrollspy ki to whakatere pae runga, taapiri noa data-spy="scroll"
ki te huānga e hiahia ana koe ki te tutei (te nuinga ko te tinana tenei) me data-target=".navbar"
te whiriwhiri ko tehea nav hei whakamahi. Ka hiahia koe ki te whakamahi i te scrollspy me tetahi .nav
waahanga.
- <body data-spy = "scroll" data-target = ".navbar" > ... </body>
Karangatia te scrollspy mā JavaScript:
- $ ( '#navbar' ). scrollspy ()
<a href="#home">home</a>
me rite ki tetahi mea i roto i te dom rite
<div id="home"></div>
.
Ina whakamahi i te scrollspy me te taapiri, te tango ranei i nga huānga mai i te DOM, me waea koe ki te tikanga whakahou penei:
- $ ( '[data-spy="scroll"]' ). ia ( mahi () {
- var $spy = $ ( tenei ). scrollspy ( 'whakahou' )
- });
Ko nga whiringa ka taea te tuku ma nga huanga raraunga, JavaScript ranei. Mo nga huanga raraunga, apitihia te ingoa whiringa ki data-
, penei i te data-offset=""
.
Ingoa | momo | taunoa | whakaahuatanga |
---|---|---|---|
whakatiki | tau | 10 | Pika hei whakatiki mai i runga i te tatau i te waahi o te panuku. |
Takahanga | Whakaahuatanga |
---|---|
whakahohe | Ka pupuhi tenei takahanga i nga wa katoa ka whakahohehia he mea hou e te scrollspy. |
Tāpirihia te mahinga ripa tere, hihiko ki te whakawhiti i roto i nga pihanga o nga ihirangi o te rohe, ahakoa ma nga tahua takaiho.
Kare pea koe i rongo ki a ratou he tarau jean Austin. Nesciunt tofu stumptown aliqua, retro synth master horoi. Moutere cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex wheke. A tuu i te salvia cillum iphone. Seitan aliquip quis cardigan kakahu a Amerika, te kai patu patu i etahi 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.
Whakahohehia nga ripa ripa ma te JavaScript (me whakahohe takitahi ia ripa):
- $ ( '#myTab a' ). pawhiria ( mahi ( e ) {
- e . āraiTaunoa ();
- $ ( tenei ). ripa ( 'whakaatu' );
- })
Ka taea e koe te whakahohe i nga ripa takitahi i roto i nga huarahi maha:
- $ ( '#myTab a[href="#profile"]' ). ripa ( 'whakaatu' ); // Tīpakohia te ripa mā te ingoa
- $ ( '#myTab a:tuatahi' ). ripa ( 'whakaatu' ); // Tīpakohia te ripa tuatahi
- $ ( '#myTab a: last' ). ripa ( 'whakaatu' ); // Tīpakohia te ripa whakamutunga
- $ ( '#myTab li:eq(2) a' ). ripa ( 'whakaatu' ); // Tīpakohia te ripa tuatoru (0-taupū)
Ka taea e koe te whakahohe i te whakatere ripa, pire ranei me te kore e tuhi i tetahi JavaScript ma te tohu noa , ki runga data-toggle="tab"
ranei data-toggle="pill"
i tetahi huānga. Ko te taapiri i nga karaehe nav
me nav-tabs
nga karaehe ki te ripa ul
ka whakamahia te ahua o te ripa Bootstrap.
- <ul class = "nav nav-ripa" >
- <li><a href = "#home" data-toggle = "tab" > Home </a> </li>
- <li><a href = "#profile" data-toggle = "ripa" > Kōtaha </a> </li>
- <li><a href = "#messages" data-toggle = "ripa" > Karere </a> </li>
- <li><a href = "#settings" data-toggle = "ripa" > Tautuhinga </a> </li>
- </ul>
Ka whakahohe i te huānga ripa me te ipu ihirangi. Me whai Ripa he data-target
, he href
kohanga ipu ranei kei roto i te DOM.
- <ul class = "nav nav-tabs" id = "myTab" >
- <li class = "active" ><a href = "#home" > Home </a> </li>
- <li><a href = "#profile" > Kōtaha </a> </li>
- <li><a href = "#karere" > Nga Karere </a> </li>
- <li><a href = "#settings" > Tautuhinga </a> </li>
- </ul>
- <div class = "ripa-ihirangi" >
- <div class = "tab-pane active" id = "home" > ... </div>
- <div class = "tab-pane" id = "profile" > ... </div>
- <div class = "tab-pane" id = "nga karere" > ... </div>
- <div class = "tab-pane" id = "tautuhinga" > ... </div>
- </div>
- <hōtuhi>
- $ ( mahi () {
- $ ( '#myTab a: last' ). ripa ( 'whakaatu' );
- })
- </script>
Takahanga | Whakaahuatanga |
---|---|
whakaatu | Ka pupuhi tenei takahanga ki te whakaaturanga ripa, engari i mua i te whakaaturanga o te ripa hou. Whakamahia event.target me event.relatedTarget te aro ki te ripa hohe me te ripa hohe o mua (mehemea e waatea ana). |
whakaaturia | Ka ahi tenei takahanga ki te whakaaturanga ripa i muri i te whakaaturanga ripa. Whakamahia event.target me event.relatedTarget te aro ki te ripa hohe me te ripa hohe o mua (mehemea e waatea ana). |
- $ ( 'a[data-toggle="ripa"]' ). kei runga ( 'whakaatuhia' , mahi ( e ) {
- e . ūnga // ripa whakahohe
- e . relatedTarget // ripa o mua
- })
I whakaaweahia e te mono jQuery.tipsy pai i tuhia e Jason Frame; Ko nga aki-utauta he putanga whakahou, kaore e whakawhirinaki ki nga whakaahua, whakamahi CSS3 mo nga pakiwaituhi, me nga huanga-raraunga mo te rokiroki taitara rohe.
Mo nga take mahi, ka uru mai te aki taputapu me te popover data-apis, ko te tikanga me arawhiti koe i a koe .
Whakaparo ki runga i nga hononga i raro nei kia kite i nga aki taputapu:
Ko nga tarau tarau karekau pea koe i rongo. Pua whakaahua pahau denim mata reta vegan putea karere stumptown. Ko te quinoa 8-bit te kakahu o Amerika he terry richardson's fixie a mcsweeney's fixie te kakahu o Amerika he terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, e wha te purenga vegan chambray a loko mcsweeney. He tohunga toi tino whakahiato ahakoa te keytar , scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.
I te wa e whakamahi ana koe i nga aki taputapu me nga popovers me nga roopu whakauru Bootstrap, me whakarite e koe te container
whiringa (kua tuhia ki raro) hei karo i nga paanga taha kino.
Whakaohohia te aki taputapu ma te JavaScript:
- $ ( '#tauira' ). aki taputapu ( kōwhiringa )
Ko nga whiringa ka taea te tuku ma nga huanga raraunga, JavaScript ranei. Mo nga huanga raraunga, apitihia te ingoa whiringa ki data-
, penei i te data-animation=""
.
Ingoa | momo | taunoa | whakaahuatanga |
---|---|---|---|
hākoritanga | boolean | pono | hoatu he whakawhiti memeha css ki te aki taputapu |
html | boolean | teka | Whakauruhia te html ki te aki taputapu. Mena he teka, text ka whakamahia te tikanga a jquery ki te whakauru ihirangi ki te dom. Whakamahia te kuputuhi mena kei te awangawanga koe mo nga whakaeke XSS. |
whakanohonga | aho | mahi | 'runga' | me pehea te whakanoho i te aki taputapu - runga | raro | maui | tika |
kaiwhiriwhiri | aho | teka | Mena ka tukuna he kaiwhiriwhiri, ka tukuna nga taonga aki taputapu ki nga whaainga kua tohua. |
taitara | aho | mahi | '' | uara taitara taunoa mena karekau he tohu `taitara` |
keu | aho | 'whakaaro arotahi' | pehea te aki utauta e whakaohohia ana - pawhiria | whakaparo | arotahi | ā-ringa. Kia mahara koe he maha nga keu keu, he waahi wehe, he momo keu. |
whakaroa | tau | ahanoa | 0 | whakaroa te whakaatu me te huna i te aki taputapu (ms) - kaore e pa ki te momo keu a-ringa Mena ka tukuna he nama, ka tukuna he whakaroa ki te huna/whakakitenga e rua Ko te hanganga ahanoa: |
ipu | aho | teka | teka | He taapiri i te aki taputapu ki tetahi huānga motuhake |
- <a href = "#" data-toggle = "taputapu" title = "matautauta tuatahi" > whakaparo ki runga i ahau </a>
Ka taapirihia he kaihautu taputapu ki tetahi kohinga huānga.
He whakaatu i te aki taputapu o tetahi huānga.
- $ ( '#huānga' ). aki taputapu ( 'whakaatu' )
Hunaia te aki taputapu o tetahi huānga.
- $ ( '#huānga' ). aki taputapu ( 'huna' )
Ka takahurihia te akiutauta o tetahi huānga.
- $ ( '#huānga' ). aki taputapu ( 'takahuri' )
He huna me te whakangaro i te aki taputapu o tetahi huānga.
- $ ( '#huānga' ). aki taputapu ( 'whakangaromia' )
Tāpirihia nga whakakikorua iti o te ihirangi, penei i era i runga i te iPad, ki tetahi huānga mo nga korero tuarua mo te whare. Whakaparo ki runga i te paatene hei whakaoho i te pouver. Me whakauru te Akiutauta .
E wha nga whiringa e waatea ana: runga, matau, raro me te taha maui.
Ko te posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Ko te posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Ko te posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Ko te posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Karekau he tohu e whakaatuhia ana ko nga popovers ka puta mai i te JavaScript me nga ihirangi kei roto i tetahi data
huanga.
Whakahohehia nga popovers ma JavaScript:
- $ ( '#tauira' ). popover ( kōwhiringa )
Ko nga whiringa ka taea te tuku ma nga huanga raraunga, JavaScript ranei. Mo nga huanga raraunga, apitihia te ingoa whiringa ki data-
, penei i te data-animation=""
.
Ingoa | momo | taunoa | whakaahuatanga |
---|---|---|---|
hākoritanga | boolean | pono | hoatu he whakawhiti memeha css ki te aki taputapu |
html | boolean | teka | Kōkuhutia te html ki roto i te popover. Mena he teka, text ka whakamahia te tikanga a jquery ki te whakauru ihirangi ki te dom. Whakamahia te kuputuhi mena kei te awangawanga koe mo nga whakaeke XSS. |
whakanohonga | aho | mahi | 'tika' | me pehea te whakanoho i te pouver - runga | raro | maui | tika |
kaiwhiriwhiri | aho | teka | ki te tukuna he kaiwhiriwhiri, ka tukuna nga taonga taputapu ki nga whaainga kua tohua |
keu | aho | 'pāwhiri' | me pehea te whakaoho o te popover - pawhiria | whakaparo | arotahi | ā-ringa |
taitara | aho | mahi | '' | uara taitara taunoa mena karekau te huanga `taitara` |
ihirangi | aho | mahi | '' | uara ihirangi taunoa ki te kore te huanga `raraunga-ihirangi` |
whakaroa | tau | ahanoa | 0 | whakaroa te whakaatu me te huna i te popover (ms) - kaore e pa ki te momo keu a-ringa Mena ka tukuna he nama, ka tukuna he whakaroa ki te huna/whakakitenga e rua Ko te hanganga ahanoa: |
ipu | aho | teka | teka | He taapiri i te pouver ki tetahi huānga motuhake |
Mo nga take mahi, ka uru mai te Aki Utauta me te Popover data-apis. Mena kei te pirangi koe ki te whakamahi, tohua he kowhiringa kaiwhiriwhiri.
Ka arataki popover mo te kohinga huānga.
He whakaatu i tetahi huānga popover.
- $ ( '#huānga' ). popover ( 'whakaatu' )
Hunaia he huānga popover.
- $ ( '#huānga' ). popover ( 'huna' )
Ka takahuri i tetahi huānga popover.
- $ ( '#huānga' ). popover ( 'takahuri' )
Huna me te whakangaro i te popover o tetahi huānga.
- $ ( '#huānga' ). popover ( 'whakangaromia' )
Tāpirihia te mahi whakakore ki nga karere mataara katoa me tenei mono.
Hurihia tenei me tera ka ngana ano. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.
Whakahohehia te whakakore i te matohi ma te JavaScript:
- $ ( ".matohi" ). mataara ()
Taapiri noa data-dismiss="alert"
ki to patene kati hei hoatu aunoa i te mahi kati matohi.
- <a class = "kati" data-dismiss = "matohi" href = "#" > × </a>
Ka takai i nga matohi katoa me te mahi tata. Kia whakakorikorihia o matohi ina katia, me mohio kei a raatau te karaehe .fade
me .in
te karaehe kua tukuna ki a raatau.
Katia he matohi.
- $ ( ".matohi" ). mataara ( 'kati' )
Ko te karaehe mataara a Bootstrap e whakaatu ana i etahi huihuinga mo te hono ki te mahi mataara.
Takahanga | Whakaahuatanga |
---|---|
kati | Ka pupuhi tenei takahanga ina ka close karangahia te aratuka tauira. |
katia | Ka puhia tenei takahanga ina katia te matohi (ka tatari kia oti nga whakawhitinga css). |
- $ ( '#taku-matohi' ). herea ( 'katia' , mahi () {
- // mahia tetahi mea…
- })
Tikina nga momo turanga me te tautoko ngawari mo nga waahanga tiango penei i te accordions me te whakatere.
* Me whakauru te mono Whakawhiti.
Ma te whakamahi i te mono tiango, i hangaia e matou he widget ahua accordion ngawari:
- <div class = "accordion" id = "accordion2" >
- <div class = "akordion-rōpū" >
- <div class = "akordion-upoko" >
- <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseOne" >
- Tūemi Rōpū Tiango #1
- </a>
- </div>
- <div id = "collapseOne" class = "akordion-tinana tiango ki roto" >
- <div class = "akordion-roto" >
- Anim pariatur cliche...
- </div>
- </div>
- </div>
- <div class = "akordion-rōpū" >
- <div class = "akordion-upoko" >
- <a class = "accordion-toggle" data-toggle = "collapse" data-parent = "#accordion2" href = "#collapseTwo" >
- Tūemi Rōpū Tiango #2
- </a>
- </div>
- <div id = "collapseTwo" class = "accordion-body collapse" >
- <div class = "akordion-roto" >
- Anim pariatur cliche...
- </div>
- </div>
- </div>
- </div>
- ...
Ka taea hoki e koe te whakamahi i te mono me te kore te tohu accordion. Hangaia he paatene takahuri te whakaroa me te tiango o tetahi atu huānga.
- < type button = "pātene" class = "btn btn-dater" data-toggle = "tiango" data-target = "#demo" >
- ngawari te tiango
- </pātene>
- <div id = "demo" class = "collapse in" > … </div>
Tāpiri noa data-toggle="collapse"
me te data-target
ki te huānga ki te tautapa aunoa i te mana o te huānga tiango. Ka data-target
whakaaetia e te huanga he kaikowhiri css hei hoatu i te tiango ki. Me tino taapiri te karaehe collapse
ki te huānga tiango. Mena kei te pirangi koe kia tuwhera taunoa, taapirihia te akomanga taapiri in
.
Hei taapiri i te whakahaere roopu rite-akordion ki te mana tiango, taapirihia te huanga raraunga data-parent="#selector"
. Tirohia te demo kia kite i tenei mahi.
Whakahohe ā-ringa ki:
- $ ( ".collapse" ). tiango ()
Ko nga whiringa ka taea te tuku ma nga huanga raraunga, JavaScript ranei. Mo nga huanga raraunga, apitihia te ingoa whiringa ki data-
, penei i te data-parent=""
.
Ingoa | momo | taunoa | whakaahuatanga |
---|---|---|---|
matua | kaiwhiriwhiri | teka | Ki te kaikowhiri ka kati nga huānga tiango katoa i raro i te matua kua tohua ina whakaatuhia tenei mea tiango. (he rite ki te whanonga akoriona tuku iho) |
takahuri | boolean | pono | Ka takahuri i te huānga tiango i runga i te inoi |
Ka whakahohe i to ihirangi hei huānga tiango. Ka whakaae ki nga whiringa whiriwhiri object
.
- $ ( '#myCollapsible' ). tiango ({
- takahuri : teka
- })
Ka takahuri i tetahi huānga tiango hei whakaatu, huna ranei.
Ka whakaatu i tetahi huānga tiango.
Hunaia he huānga tiango.
Ko te karaehe tiango a Bootstrap e whakaatu ana i etahi huihuinga mo te hono ki te mahi tiango.
Takahanga | Whakaahuatanga |
---|---|
whakaatu | Ka pupuhi tenei takahanga ina ka show karangahia te aratuka tauira. |
whakaaturia | Ka puhia tenei takahanga ina kitea he huānga tiango ki te kaiwhakamahi (ka tatari kia oti nga whakawhitinga css). |
huna | Ka pupuhihia tenei kaupapa i te wa hide i kiia ai te tikanga. |
huna | Ka puhia tenei takahanga ina hunahia he huānga tiango mai i te kaiwhakamahi (ka tatari kia oti nga whakawhitinga css). |
- $ ( '#myCollapsible' ). kei runga ( 'huna' , mahi () {
- // mahia tetahi mea…
- })
Ko te whakaatakiriata i raro nei e whakaatu ana i tetahi mono me te waahanga mo te eke paihikara ma nga huānga penei i te carousel.
- <div id = "myCarousel" class = "carousel slide" >
- <ol class = "carousel-tohu" >
- <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>
- <!-- Tuemi Carousel -->
- <div class = "carousel-roto" >
- <div class = "tuemi hohe" > … </div>
- <div class = "tuemi" > … </div>
- <div class = "tuemi" > … </div>
- </div>
- <!-- Carousel nav -->
- <a class = "carousel-control left" href = "#myCarousel" data-slide = "mua" > ‹ </a>
- <a class = "carousel-control right" href = "#myCarousel" data-slide = "muri" > › </a>
- </div>
Whakamahia nga huanga raraunga kia ngawari te whakahaere i te tuunga o te carousel. data-slide
ka whakaae ki nga kupumatua prev
, next
, ka whakarereke i te tuunga kiriata e pa ana ki tona turanga o naianei. Arā, whakamahia data-slide-to
ki te tuku i te taupū kiriata mata ki te carousel data-slide-to="2"
, e peke ana i te tūnga kiriata ki tetahi taupū ka timata ki te 0
.
Waea a ringatia te carousel me:
- $ ( '.carousel' ). carousel ()
Ko nga whiringa ka taea te tuku ma nga huanga raraunga, JavaScriptz ranei. Mo nga huanga raraunga, apitihia te ingoa whiringa ki data-
, penei i te data-interval=""
.
Ingoa | momo | taunoa | whakaahuatanga |
---|---|---|---|
wā | tau | 5000 | Te nui o te wa ki te whakaroa i waenga i te paihikara aunoa i tetahi mea. Mena he teka, e kore e huri aunoa a carousel. |
okioki | aho | "whakapapa" | Ka whakataa te paihikara o te carousel i runga i te kiore, ka timata ano te paihikara o te carousel i runga i te kiore. |
Ka arataki i te carousel me etahi whiringa object
ka tiimata ka timata te paihikara i roto i nga taonga.
- $ ( '.carousel' ). carousel ({
- wā : 2000
- })
Ka huri i nga taonga carousel mai i te maui ki te matau.
Ka aukati te carousel i te eke paihikara ma nga taonga.
Ka huri i te carousel ki tetahi anga (0 te ahua, he rite ki te huranga).
Ka huri ki te mea o mua.
Ka huri ki te tuemi e whai ake nei.
Ko te karaehe carousel a Bootstrap e whakaatu ana i nga huihuinga e rua mo te hono ki te mahi carousel.
Takahanga | Whakaahuatanga |
---|---|
kiriata | Ka puhipuhi tonu tenei takahanga ina ka tonohia te slide aratuka tauira. |
paheke | Ka pupuhihia tenei takahanga ina oti ana te carousel i tana whakawhiti kiriata. |
He mono taketake, ngawari te whakaroa mo te hanga tere i nga momo upoko huatau me nga momo whakauru kuputuhi.
- < momo whakauru = "kuputuhi" raraunga-provide = "typeahead" >
Ka hiahia koe ki te tautuhi autocomplete="off"
kia kore e puta nga tahua kaitirotiro taunoa ki runga i te maturuturunga iho o Bootstrap typeahead.
Taapirihia nga huanga raraunga hei rehita i tetahi huānga me te mahi a te momotuhi e whakaatuhia ana i te tauira i runga ake nei.
Waea a ringa ki te upoko patopato me:
- $ ( '.typeahead' ). upoko patopato ()
Ko nga whiringa ka taea te tuku ma nga huanga raraunga, JavaScript ranei. Mo nga huanga raraunga, apitihia te ingoa whiringa ki data-
, penei i te data-source=""
.
Ingoa | momo | taunoa | whakaahuatanga |
---|---|---|---|
puna | huinga, mahi | [ ] | Ko te puna raraunga hei patai. He huinga aho, he mahi ranei. Ka tukuna te mahi e rua nga tohenga, ko te query uara ki te mara whakauru me te process hokinga hoki. Ka taea te whakamahi i te taumahi ma te whakahoki tika i te puna raraunga, ma te tukutahi ranei ma te process tohenga kotahi a te waea hoki. |
tūemi | tau | 8 | Ko te maha o nga taonga hei whakaatu i te takaiho. |
minRoa | tau | 1 | Ko te roanga iti o te ahua e hiahiatia ana i mua i te whakaoho i nga whakaaro whakaoti aunoa |
kaiwhakariterite | mahi | take koretake | Ko te tikanga e whakamahia ana hei whakatau mena ka taurite tetahi patai ki tetahi mea. Ka whakaae ki te tohenga kotahi, ko te item mea hei whakamatautau i te patai. Uru ki te uiui onāianei me te this.query . Whakahokia he boolean true mena he taurite te patai. |
kaihoroi | mahi | ōrite tika, take tairongo, take tairongo |
Tikanga i whakamahia hei kōmaka i nga hua whakaoti aunoa. Ka whakaae ki te tohenga kotahi items , a, kei a ia te whānuitanga o te tauira o te upoko patopato. Tohutoro te patai onāianei me te this.query . |
kaiwhakahou | mahi | ka whakahoki mai i nga mea kua tohua | Ko te tikanga i whakamahia hei whakahoki mai i nga mea kua tohua. Ka whakaae ki te tohenga kotahi, te item a kei a ia te whānuitanga o te tauira o te upoko patopato. |
miramira | mahi | e whakaatu ana i nga whakataetae taunoa katoa | Tikanga hei whakanui i nga hua whakaoti-aunoa. Ka whakaae ki te tohenga kotahi item , a, kei a ia te whānuitanga o te tauira o te upoko patopato. Me whakahoki html. |
Ka arataki i te whakaurunga me te upoko patopato.
Ko te whakaterenga i te taha maui he whakaaturanga ora o te mono affix.
Kia ngawari te taapiri i te whanonga piri ki tetahi huānga, taapiri noa data-spy="affix"
ki te huānga e hiahia ana koe ki te tutei. Na ka whakamahi i nga waahi hei tautuhi i te wa e huri ai te titi o te huānga ki runga me te weto.
- <div data-spy = "affix" data-offset-top = "200" > ... </div>
affix
,
affix-top
, me
affix-bottom
. Kia mahara ki te tirotiro mo tetahi matua kua tiango pea ina whana te apiti i te wa e tango ana i nga ihirangi mai i te rere noa o te wharangi.
Karangatia te mono affix ma te JavaScript:
- $ ( '#navbar' ). whakapiri ()
Ko nga whiringa ka taea te tuku ma nga huanga raraunga, JavaScript ranei. Mo nga huanga raraunga, apitihia te ingoa whiringa ki data-
, penei i te data-offset-top="200"
.
Ingoa | momo | taunoa | whakaahuatanga |
---|---|---|---|
whakatiki | tau | mahi | ahanoa | 10 | Pika hei whakatiki mai i te mata i te tatau i te tuunga o te panuku. Mēnā ka tukuna he tau kotahi, ka hoatu te whakakē ki te taha o runga me te taha maui. Ki te whakarongo ki te ahunga kotahi, ki te maha ranei o nga wehenga ahurei, homai noa he ahanoa offset: { x: 10 } . Whakamahia he mahi ina hiahia koe ki te whakarato hihiko i te utu (he whai hua mo etahi hoahoa aro). |