Mu awọn paati Bootstrap wa si igbesi aye — ni bayi pẹlu awọn afikun jQuery aṣa 12.
Iṣatunṣe, ṣugbọn rọ, mu ohun itanna modal JavaScript ti aṣa pẹlu iṣẹ ṣiṣe ti o kere julọ ti o nilo ati awọn aseku ọlọgbọn.
Ṣafikun awọn akojọ aṣayan silẹ si fere ohunkohun ni Bootstrap pẹlu itanna ti o rọrun yii. Bootstrap ni atilẹyin akojọ aṣayan silẹ ni kikun lori navbar, awọn taabu, ati awọn oogun.
Lo scrollspy lati ṣe imudojuiwọn awọn ọna asopọ ni navbar rẹ laifọwọyi lati ṣafihan ọna asopọ lọwọlọwọ ti o da lori ipo yi lọ.
Lo ohun itanna yii lati jẹ ki awọn taabu ati awọn oogun wulo diẹ sii nipa gbigba wọn laaye lati yi lọ nipasẹ awọn pane tabbable ti akoonu agbegbe.
Gbigba tuntun lori jQuery Tipsy itanna, Awọn ohun elo irinṣẹ ko gbẹkẹle awọn aworan — wọn lo CSS3 fun awọn ohun idanilaraya ati awọn abuda data fun ibi ipamọ akọle agbegbe.
Ṣafikun awọn agbekọja kekere ti akoonu, bii awọn ti o wa lori iPad, si eyikeyi ipin fun alaye Atẹle ile.
* Nilo Awọn imọran irinṣẹ lati wa pẹlu
Ohun itanna gbigbọn jẹ kilasi kekere fun fifi iṣẹ ṣiṣe to sunmọ si awọn titaniji.
Ṣe diẹ sii pẹlu awọn bọtini. Awọn ipinlẹ bọtini iṣakoso tabi ṣẹda awọn ẹgbẹ ti awọn bọtini fun awọn paati diẹ sii bi awọn ọpa irinṣẹ.
Gba awọn aza ipilẹ ati atilẹyin to rọ fun awọn paati ikojọpọ bi accordions ati lilọ kiri.
Ṣẹda ariya-go-yika ti eyikeyi akoonu ti o fẹ lati pese ohun ibanisọrọ agbelera akoonu.
Ipilẹ kan, ohun itanna ti o gbooro ni irọrun fun ṣiṣẹda ni iyara awọn oriṣi ti o wuyi pẹlu titẹ ọrọ fọọmu eyikeyi.
Fun awọn ipa iyipada ti o rọrun, pẹlu bootstrap-transition.js lẹẹkan lati rọra ni awọn modals tabi ipare awọn titaniji.
* Ti beere fun iwara ni awọn afikun
Iṣatunṣe, ṣugbọn rọ, mu ohun itanna modal JavaScript ti aṣa pẹlu iṣẹ ṣiṣe ti o kere julọ ti o nilo ati awọn aseku ọlọgbọn.
Ṣe igbasilẹ failiNi isalẹ jẹ modal ti a ṣe ni iṣiro.
Ara kan ti o dara…
Yi modal pada nipasẹ JavaScript nipa titẹ bọtini ni isalẹ. Yoo rọra si isalẹ ati ipare ni lati oke ti oju-iwe naa.
Ifilọlẹ demo modalPe modal nipasẹ JavaScript:
- $ ( '#myModal' ). modal ( awọn aṣayan )
Oruko | iru | aiyipada | apejuwe |
---|---|---|---|
sile | boolian | ooto | Pẹlu a modal-backdrop ano. Ni omiiran, pato static fun ẹhin ẹhin eyiti ko pa modal naa ni titẹ. |
keyboard | boolian | ooto | Tilekun modal nigbati o ba tẹ bọtini ona abayo |
ifihan | boolian | ooto | Ṣe afihan modal nigbati o bẹrẹ. |
O le mu awọn modals ṣiṣẹ lori oju-iwe rẹ ni irọrun laisi nini lati kọ laini kan ti JavaScript. O kan ṣeto data-toggle="modal"
lori eroja oludari pẹlu kan data-target="#foo"
tabi href="#foo"
eyiti o ni ibamu si id ano modal, ati nigbati o ba tẹ, yoo ṣe ifilọlẹ modal rẹ.
Paapaa, lati ṣafikun awọn aṣayan si apẹẹrẹ modal rẹ, kan ṣafikun wọn bi awọn abuda data afikun lori boya ipin iṣakoso tabi isamisi modal funrararẹ.
- <a class = "btn" data-toggle = "modal" href = "#myModal" > Ilana ifilọlẹ </a>
- <div class = "modal hide" id = "myModal" >
- <div kilasi = "modal-akọsori" >
- <bọtini iru = "bọtini" kilasi = "sunmọ" data-dismiss = "modal" > × </bọtini>
- <h3> Akọsori awoṣe </h3>
- </div>
- <div class = "modal-body" >
- <p> Ara kan ti o dara… </p>
- </div>
- <div class = "modal-footer" >
- <a href = "#" kilasi = "btn" data-dismiss = "modal" > Pade </a>
- <a href = "#" kilasi = "btn btn-primary" > Fipamọ awọn ayipada </a>
- </div>
- </div>
.fade
kilasi kan si
.modal
ipin (tọkasi demo lati rii eyi ni iṣe) ati pẹlu bootstrap-transition.js.
Mu akoonu rẹ ṣiṣẹ bi modal. Gba awọn aṣayan iyan object
.
- $ ( '#myModal' ). modal ({
- keyboard : eke
- })
Pẹlu ọwọ yipada modal kan.
- $ ( '#myModal' ). modal ( 'bayi' )
Pẹlu ọwọ ṣii modal kan.
- $ ( '#myModal' ). modal ( 'ifihan' )
Pẹlu ọwọ hides a modal.
- $ ( '#myModal' ). modal ( 'tọju' )
Kilasi modal Bootstrap ṣafihan awọn iṣẹlẹ diẹ fun sisọ sinu iṣẹ ṣiṣe modal.
Iṣẹlẹ | Apejuwe |
---|---|
ifihan | Yi iṣẹlẹ ina lẹsẹkẹsẹ nigbati awọn show apẹẹrẹ ọna ti a npe ni. |
han | Iṣẹlẹ yii jẹ ina nigbati modal ti jẹ ki o han si olumulo (yoo duro fun awọn iyipada css lati pari). |
tọju | Iṣẹlẹ yii jẹ ina lẹsẹkẹsẹ nigbati ọna hide apẹẹrẹ ti pe. |
farasin | Iṣẹlẹ yii jẹ ina nigbati modal naa ba ti pari fifipamọ lati ọdọ olumulo (yoo duro fun awọn iyipada css lati pari). |
- $ ( '#myModal' ). lori ( 'farasin' , iṣẹ () {
- // se nkan…
- })
Ṣafikun awọn akojọ aṣayan silẹ si fere ohunkohun ni Bootstrap pẹlu itanna ti o rọrun yii. Bootstrap ni atilẹyin akojọ aṣayan silẹ ni kikun lori navbar, awọn taabu, ati awọn oogun.
Ṣe igbasilẹ failiTẹ lori awọn ọna asopọ nav dropdown ni navbar ati awọn ìşọmọbí ni isalẹ lati se idanwo dropdowns.
Pe awọn silẹ nipasẹ JavaScript:
- $ ( '.dropdown-toggle' ). silẹ ()
Lati fi iṣẹ ṣiṣe silẹ ni kiakia si eyikeyi eroja kan ṣafikun data-toggle="dropdown"
ati eyikeyi silẹ bootstrap to wulo yoo muu ṣiṣẹ laifọwọyi.
data-target="#fat"
tabi
href="#fat"
.
- <ul kilasi = "nav nav-pills" >
- <li class = "active" ><a href = "#" > Ọna asopọ deede </a></li>
- <li kilasi = "silẹ silẹ" id = "akojọ aṣyn1" >
- <a class = "dropdown-toggle" data-toggle = "silẹ silẹ" href = "#menu1" >
- Faa silẹ
- <b kilasi = "abojuto" </b>
- </a>
- <ul kilasi = "akojọ-silẹ silẹ" >
- <li><a href = "#" > Iṣẹ́ </a></li>
- <li><a href = "#" > Iṣẹ́ míràn </a></li>
- <li><a href = "#" > Nkankan miran nibi </a></li>
- <li kilasi = "olupin" </li>
- <li><a href = "#" > Ọna asopọ ti o ya sọtọ </a></li>
- </ul>
- </li>
- ...
- </ul>
Lati jẹ ki awọn URL wa titi, lo data-target
abuda dipo href="#"
.
- <ul kilasi = "nav nav-pills" >
- <li kilasi = "silẹ silẹ" >
- <a class = "dropdown-toggle" data-toggle = "dropdown" data-target = "#" href = "pato/to/page.html" >
- Faa silẹ
- <b kilasi = "abojuto" </b>
- </a>
- <ul kilasi = "akojọ-silẹ silẹ" >
- ...
- </ul>
- </li>
- </ul>
Api eto kan fun ṣiṣiṣẹ awọn akojọ aṣayan fun navbar ti a fun tabi lilọ kiri taabu.
Ohun itanna ScrollSpy jẹ fun mimu dojuiwọn awọn ibi-afẹde nav laifọwọyi da lori ipo yi lọ.
Ṣe igbasilẹ failiYi lọ si agbegbe ni isalẹ ki o wo imudojuiwọn lilọ kiri. Awọn nkan isọ silẹ yoo jẹ afihan bi daradara. Danwo!
Ad leggings keytar, brunch id art party dolor labour. Pitchfork yr enim lo-fi kí wọn tó ta qui. Tumblr oko-to-tabili awọn ẹtọ keke ohunkohun ti. Animu keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby siweta lomo Jean shorts, Williamsburg hoodie minim qui o jasi ko ti gbọ ti wọn et cardigan Trust fund culpa biodiesel wes anderson aesthetic. Nihi tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork irungbọn. Freegan irungbọn aliqua cupidatat mcsweeney ká vero. Cupidatat mẹrin loko nisi, ea helvetica nulla carles. Tatuu cosby siweta ounje ikoledanu, mcsweeney ká quis ti kii freegan fainali. Lo-fi wes anderson +1 sartorial. Carles ti kii ṣe adaṣe darapupo quis gentrify. Brooklyn adipisicing ọnà ọti igbakeji keytar deserunt.
Occaecat commodo aliqua delectus. Fap iṣẹ ọti deserunt skateboard ea. Lomo keke awọn ẹtọ adipisicing banh mi, velit ea sunt next level locavore nikan-origin kofi in magna veniam. Giga aye id fainali, iwoyi o duro si ibikan consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim ojiṣẹ apo. cred ex in, alagbero delectus consectetur fanny pack ipad.
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 bulọọgi, culpa ojiṣẹ apo marfa ohunkohun ti delectus ounje ikoledanu. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats o jasi ko tii gbọ ti wọn consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat ṣaaju ki wọn to ta, Terry Richardson proident brunch nesciunt quis cosby siweta pariatur keffiyeh ut helvetica artisan. Cardigan iṣẹ ọti seitan readymade velit. VHS chambray laboris tempor veniam. Animu mollit minim commodo ullamco thundercats.
Pe scrollspy nipasẹ JavaScript:
- $ ( '#navbar' ). scrollspy ()
Lati fi awọn iṣọrọ scrollspy ihuwasi si rẹ topbar lilọ, o kan fi data-spy="scroll"
si awọn ano ti o fẹ lati ṣe amí lori (julọ ojo melo yi yoo jẹ awọn ara).
- <body data-spy = "yi lọ" > ... </body>
<a href="#home">home</a>
gbọdọ ba nkan ṣe ni dom bi
<div id="home"></div>
.
Nigbati o ba nlo scrollspy ni apapo pẹlu fifi kun tabi yiyọ awọn eroja kuro lati DOM, iwọ yoo nilo lati pe ọna isọdọtun bii bẹ:
- $ ( '[data-spy="yilọ" ). kọọkan ( iṣẹ () {
- var $ amí = $ ( eyi ). scrollspy ( 'itura' )
- });
Oruko | iru | aiyipada | apejuwe |
---|---|---|---|
aiṣedeede | nọmba | 10 | Awọn piksẹli lati aiṣedeede lati oke nigbati o ṣe iṣiro ipo ti yi lọ. |
Iṣẹlẹ | Apejuwe |
---|---|
mu ṣiṣẹ | Iṣẹlẹ yii n ṣiṣẹ nigbakugba ti ohun kan ba muu ṣiṣẹ nipasẹ scrollspy. |
Ohun itanna yii ṣe afikun iyara, taabu ti o ni agbara ati iṣẹ ṣiṣe egbogi fun iyipada nipasẹ akoonu agbegbe.
Ṣe igbasilẹ failiTẹ awọn taabu ti o wa ni isalẹ lati yi laarin awọn pane ti o farapamọ, paapaa nipasẹ awọn akojọ aṣayan silẹ.
Aise Denimu o jasi ko ti gbọ ti wọn Jean shorts Austin. Nesciunt tofu stumptown aliqua, Retiro synth titunto si wẹ. 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 ipad. Seitan aliquip quis cardigan American aso, 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 ki wọn to ta oluwa wẹ giluteni-free squid scenester freegan cosby siweta. Fanny pack portland seitan DIY, art party locavore Ikooko cliche ga aye iwoyi o duro si ibikan Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi ṣaaju ki wọn to ta oko-si-tabili VHS gbogun ti locavore cosby siweta. Lomo wolf viral, mustache readymade thundercats keffiyeh craft ọti marfa ethical. Wolf salvia freegan, sartorial keffiyeh iwoyi o duro si ibikan ajewebe.
Mu awọn taabu taabu ṣiṣẹ nipasẹ JavaScript (taabu kọọkan nilo lati muu ṣiṣẹ ni ẹyọkan):
- $ ( '#myTab a' ). tẹ ( iṣẹ ( e ) {
- e . idilọwọ Aiyipada ();
- $ ( eyi ). taabu ( 'ifihan' );
- })
O le mu awọn taabu kọọkan ṣiṣẹ ni awọn ọna pupọ:
- $ ( '#myTab a[href="#profaili"]' ). taabu ( 'ifihan' ); // Yan taabu nipa orukọ
- $ ( '#myTab a: akọkọ' ). taabu ( 'ifihan' ); // Yan taabu akọkọ
- $ ( '#myTab a: kẹhin' ). taabu ( 'ifihan' ); // Yan kẹhin taabu
- $ ( '#myTab li: eq(2) a' ). taabu ( 'ifihan' ); // Yan taabu kẹta (0-itọkasi)
O le mu taabu kan ṣiṣẹ tabi lilọ kiri egbogi laisi kikọ eyikeyi JavaScript nipa sisọ pato data-toggle="tab"
tabi data-toggle="pill"
lori eroja kan. Ṣafikun nav
ati nav-tabs
awọn kilasi si taabu ul
yoo lo iselona taabu bootstrap.
- <ul kilasi = "nav nav-tabs" >
- <li><a href = "#home" data-toggle = "taabu" > Ile </a></li>
- <li><a href = "#profile" data-toggle = "taabu" > Profaili </a></li>
- <li><a href = "#messages" data-toggle = "taabu" > Awọn ifiranṣẹ </a></li>
- <li><a href = "#settings" data-toggle = "taabu" > Eto </a></li>
- </ul>
Mu eroja taabu ṣiṣẹ ati eiyan akoonu. Taabu yẹ ki o ni boya a data-target
tabi href
ifọkansi oju ipade apoti kan ninu DOM.
- <ul kilasi = "nav nav-tabs" id = "myTab" >
- <li class = "lọwọ" ><a href = "#ile" > Ile </a></li>
- <li > <a href = "#profaili"> Profaili </a></li>
- <li><a href = "#messages" > Awọn ifiranṣẹ </a></li>
- <li><a href = "#eto" > Eto </a></li>
- </ul>
- <div class = "akoonu-taabu" >
- <div class = "tab-pane active" id = "ile" > ... </div>
- <div class = "tab-pane" id = "profaili" > ... </div>
- <div class = "tab-pane" id = "awọn ifiranṣẹ" > ... </div>
- <div class = "tab-pane" id = "awọn eto" > ... </div>
- </div>
- <akosile>
- $ ( iṣẹ () {
- $ ( '#myTab a: kẹhin' ). taabu ( 'ifihan' );
- })
- </script>
Iṣẹlẹ | Apejuwe |
---|---|
ifihan | Iṣẹlẹ yii ina lori ifihan taabu, ṣugbọn ṣaaju ki o to han taabu tuntun. Lo event.target ati event.relatedTarget lati fojusi taabu ti nṣiṣe lọwọ ati taabu lọwọlọwọ ti tẹlẹ (ti o ba wa) lẹsẹsẹ. |
han | Iṣẹlẹ yi ina lori ifihan taabu lẹhin ti a ti fi taabu kan han. Lo event.target ati event.relatedTarget lati fojusi taabu ti nṣiṣe lọwọ ati taabu lọwọlọwọ ti tẹlẹ (ti o ba wa) lẹsẹsẹ. |
- $ ( 'a[data-toggle = "taabu"]' ). lori ( 'fi han' , iṣẹ ( e ) {
- e . afojusun // mu ṣiṣẹ taabu
- e . jẹmọTarget // ti tẹlẹ taabu
- })
Atilẹyin nipasẹ ohun itanna jQuery.tipsy ti o dara julọ ti a kọ nipasẹ Jason Frame; Awọn imọran irinṣẹ jẹ ẹya imudojuiwọn, eyiti ko gbẹkẹle awọn aworan, lo css3 fun awọn ohun idanilaraya, ati awọn abuda data fun ibi ipamọ akọle agbegbe.
Ṣe igbasilẹ failiRaba lori awọn ọna asopọ ni isalẹ lati wo awọn imọran irinṣẹ:
Awọn sokoto to gun ni ipele keji keffiyeh o ṣee ṣe ko tii gbọ ti wọn. Photo agọ irungbọn aise Denimu letterpress ajewebe ojiṣẹ apo stumptown. Farm-to-tabili seitan, mcsweeney's fixie alagbero quinoa 8-bit American aṣọ ni Terry Richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, mẹrin loko mcsweeney ká cleanse vegan chambray. A gan ironic artisan whatever keytar , scenester farm-to-table banksy Austin twitter handle freegan cred raw Denimu nikan-Oti kofi gbogun ti.
Ṣe okunfa ohun elo irinṣẹ nipasẹ JavaScript:
- $ ( '#apẹẹrẹ' ). ohun elo ( awọn aṣayan )
Oruko | iru | aiyipada | apejuwe |
---|---|---|---|
iwara | boolian | ooto | lo iyipada css ipare si ọpa irinṣẹ |
ipo | okun | iṣẹ | 'oke' | bi o si ipo awọn Tooltip - oke | isalẹ | osi | ọtun |
yiyan | okun | eke | Ti o ba ti pese oluyan, awọn ohun elo irinṣẹ yoo jẹ aṣoju si awọn ibi-afẹde pàtó. |
akọle | okun | iṣẹ | '' | iye akọle aiyipada ti tag `akọle` ko ba si |
okunfa | okun | 'rababa' | bi o ti wa ni jeki irinṣẹ - rababa | idojukọ | Afowoyi |
idaduro | nọmba | nkan | 0 | idaduro fifihan ati fifipamọ awọn ọpa irinṣẹ (ms) - ko kan si iru okunfa afọwọṣe Ti nọmba kan ba pese, idaduro jẹ lilo si tọju/fihan mejeeji Eto nkan jẹ: |
Fun awọn idi iṣẹ ṣiṣe, Ohun elo irinṣẹ ati Agbejade data-apis n wọle. Ti o ba fẹ lati lo wọn kan pato aṣayan yiyan.
- <a href = "#" rel = "tooltip" akọle = "irinṣẹ irinṣẹ akọkọ" > rababa lori mi </a>
So oluṣakoso ohun elo irinṣẹ si ikojọpọ eroja.
Ṣe afihan ohun elo irinṣẹ eroja kan.
- $ ( '# ano' ). ọpa irinṣẹ ( 'ifihan' )
Ìbòmọlẹ ohun ano ká irinṣẹ.
- $ ( '# ano' ). ọpa irinṣẹ ( 'tọju' )
Yipada ohun elo itọsi irinṣẹ.
- $ ( '# ano' ). ọpa irinṣẹ ( 'bayi' )
Ṣafikun awọn agbekọja kekere ti akoonu, bii awọn ti o wa lori iPad, si eyikeyi ipin fun alaye Atẹle ile.
* Nilo Italolobo Irinṣẹ lati wa pẹlu
Ṣe igbasilẹ failiRaba lori bọtini lati ma nfa popover naa.
Mu popovers ṣiṣẹ nipasẹ JavaScript:
- $ ( '#apẹẹrẹ' ). popover ( awọn aṣayan )
Oruko | iru | aiyipada | apejuwe |
---|---|---|---|
iwara | boolian | ooto | lo iyipada css ipare si ọpa irinṣẹ |
ipo | okun | iṣẹ | 'ọtun' | bi o si ipo awọn popover - oke | isalẹ | osi | ọtun |
yiyan | okun | eke | ti o ba ti pese oluyanju, awọn ohun elo irinṣẹ yoo jẹ aṣoju si awọn ibi-afẹde ti a pato |
okunfa | okun | 'rababa' | bi o ti wa ni jeki irinṣẹ - rababa | idojukọ | Afowoyi |
akọle | okun | iṣẹ | '' | iye akọle aiyipada ti o ba jẹ pe ẹya 'akọle' ko si |
akoonu | okun | iṣẹ | '' | iye akoonu aiyipada ti ‘akoonu-data’ abuda ko ba si |
idaduro | nọmba | nkan | 0 | idaduro ifihan ati fifipamo popover (ms) - ko kan si iru okunfa afọwọṣe Ti nọmba kan ba pese, idaduro jẹ lilo si tọju/fihan mejeeji Eto nkan jẹ: |
Fun awọn idi iṣẹ ṣiṣe, Ohun elo irinṣẹ ati Agbejade data-apis n wọle. Ti o ba fẹ lati lo wọn kan pato aṣayan yiyan.
Initializes popovers fun ohun akojọpọ eroja.
Ṣe afihan awọn eroja popover.
- $ ( '# ano' ). popover ( 'ifihan' )
Ìbòmọlẹ ohun eroja popover.
- $ ( '# ano' ). popover ( 'tọju' )
Yipada awọn eroja agbejade.
- $ ( '# ano' ). popover ( 'yii' )
Ohun itanna gbigbọn jẹ kilasi kekere fun fifi iṣẹ ṣiṣe to sunmọ si awọn titaniji.
Gba lati ayelujaraOhun itanna titaniji ṣiṣẹ lori awọn ifiranṣẹ itaniji deede, ati dina awọn ifiranṣẹ.
Yi eyi ati iyẹn pada ki o tun gbiyanju lẹẹkansi. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.
Jeki yiyọ kuro ti itaniji nipasẹ JavaScript:
- $ ( "titaniji" ). gbigbọn ()
Kan ṣafikun data-dismiss="alert"
si bọtini isunmọ rẹ lati funni ni iṣẹ ṣiṣe isunmọ titaniji laifọwọyi.
- <a class = "sunmọ" data-dismiss = "titaniji" href = "#" > & igba; </a>
Murasilẹ gbogbo awọn titaniji pẹlu iṣẹ ṣiṣe to sunmọ. Lati jẹ ki awọn titaniji rẹ gbe jade nigba pipade, rii daju pe wọn ni .fade
ati .in
kilasi ti lo tẹlẹ si wọn.
Tilekun itaniji.
- $ ( "titaniji" ). Itaniji ( 'sunmọ' )
Kilasi gbigbọn Bootstrap ṣafihan awọn iṣẹlẹ diẹ fun sisọ sinu iṣẹ ṣiṣe titaniji.
Iṣẹlẹ | Apejuwe |
---|---|
sunmo | Yi iṣẹlẹ ina lẹsẹkẹsẹ nigbati awọn close apẹẹrẹ ọna ti a npe ni. |
ni pipade | Iṣẹlẹ yii jẹ ina nigbati itaniji ti wa ni pipade (yoo duro fun awọn iyipada css lati pari). |
- $ ( '#mi-ititaniji' ). dè ( 'ni pipade' , iṣẹ () {
- // se nkan…
- })
Gba awọn aza ipilẹ ati atilẹyin to rọ fun awọn paati ikojọpọ bi accordions ati lilọ kiri.
Ṣe igbasilẹ faili* Nilo ohun itanna Awọn iyipada lati wa pẹlu.
Lilo ohun itanna idapọ, a kọ ẹrọ ailorukọ ara accordion ti o rọrun:
Mu ṣiṣẹ nipasẹ JavaScript:
- $ ( ".collapse" ). ṣubu ()
Oruko | iru | aiyipada | apejuwe |
---|---|---|---|
obi | yiyan | eke | Ti o ba yan lẹhinna gbogbo awọn eroja ti o le kojọpọ labẹ obi ti a ti sọ ni yoo wa ni pipade nigbati ohun kan ti o le kọlu ba han. (bii iru iwa accordion ibile) |
yipada | boolian | ooto | Yipada eroja ti o le kolu lori ẹbẹ |
Kan ṣafikun data-toggle="collapse"
ati ipin data-target
kan lati fi iṣakoso laifọwọyi ti nkan kan ti o le kọlu. Ẹya naa data-target
gba oluyan css kan lati lo iṣubu si. Rii daju lati ṣafikun kilasi collapse
naa si nkan ti o le ṣubu. Ti o ba fẹ ki o ṣii aiyipada, ṣafikun afikun kilasi in
.
- <button class = "btn btn-danger" data-toggle = "collapse" data-target = "#demo" >
- o rọrun collapsible
- </bọtini>
- <div id = "demo" kilasi = "kolula sinu" > … </div>
data-parent="#selector"
. Tọkasi demo lati wo eyi ni iṣe.
Mu akoonu rẹ ṣiṣẹ bi eroja ti o le kolu. Gba awọn aṣayan iyan object
.
- $ ( '#myCollapsible' ). ṣubu ({
- toggle : iro
- })
Yipada eroja ti o le kolu lati ṣafihan tabi pamọ.
Ṣe afihan eroja ti o le ṣubu.
Ìbòmọlẹ ohun kan collapsible.
Kilasi Collapse Bootstrap ṣafihan awọn iṣẹlẹ diẹ fun sisọ sinu iṣẹ ṣiṣe iṣubu.
Iṣẹlẹ | Apejuwe |
---|---|
ifihan | Yi iṣẹlẹ ina lẹsẹkẹsẹ nigbati awọn show apẹẹrẹ ọna ti a npe ni. |
han | Iṣẹlẹ yii jẹ ina nigba ti a ti jẹ ki nkan idaruku kan han si olumulo (yoo duro fun awọn iyipada css lati pari). |
tọju | Yi iṣẹlẹ ti wa ni kuro lenu ise lẹsẹkẹsẹ nigbati awọn hide ọna ti a ti a npe ni. |
farasin | Iṣẹlẹ yii jẹ ina nigba ti ohun elo iṣubu kan ti farapamọ lati ọdọ olumulo (yoo duro fun awọn iyipada css lati pari). |
- $ ( '#myCollapsible' ). lori ( 'farasin' , iṣẹ () {
- // se nkan…
- })
Wo agbelera ni isalẹ.
Pe nipasẹ JavaScript:
- $ ( '.carousel' ). carousel ()
Oruko | iru | aiyipada | apejuwe |
---|---|---|---|
aarin | nọmba | 5000 | Iye akoko lati ṣe idaduro laarin gigun kẹkẹ ohun kan laifọwọyi. Ti o ba jẹ eke, carousel kii yoo yipo laifọwọyi. |
da duro | okun | "rababa" | Ṣe idaduro gigun kẹkẹ ti carousel lori mouseenter ati tun bẹrẹ gigun kẹkẹ ti carousel lori mouseleave. |
Awọn abuda data ni a lo fun iṣaaju ati awọn idari atẹle. Ṣayẹwo apẹẹrẹ apẹẹrẹ ni isalẹ.
- <div id = "myCarousel" kilasi = " ifaworanhan carousel " >
- <!-- Awọn nkan Carousel -->
- <div class = "carousel-inner" >
- <div class = "ohun ti nṣiṣe lọwọ" > … </div>
- <div class = "ohun kan" > … </div>
- <div class = "ohun kan" > … </div>
- </div>
- <!-- Carousel nav -->
- <a class = "carousel-control osi" href = "#myCarousel" data-slide = "prev" > ‹ </a>
- <a class = "carousel-control right" href = "#myCarousel" data-slide = "tókàn" > & rsaquo; </a>
- </div>
Ti bẹrẹ carousel pẹlu awọn aṣayan iyan object
ati bẹrẹ gigun kẹkẹ nipasẹ awọn ohun kan.
- $ ( '.carousel' ). carousel ({
- aarin : 2000
- })
Yiyipo nipasẹ awọn ohun carousel lati osi si otun.
Da carousel duro lati gigun kẹkẹ nipasẹ awọn ohun kan.
Yi kẹkẹ carousel lọ si fireemu kan pato (orisun 0, iru si orun).
Awọn iyipo si nkan ti tẹlẹ.
Awọn iyipo si nkan atẹle.
Kilasi carousel Bootstrap ṣafihan awọn iṣẹlẹ meji fun sisọ sinu iṣẹ ṣiṣe carousel.
Iṣẹlẹ | Apejuwe |
---|---|
ifaworanhan | Iṣẹlẹ yii ina lẹsẹkẹsẹ nigbati ọna slide apẹẹrẹ ba pe. |
sisun | Iṣẹlẹ yii jẹ ina nigbati carousel ti pari iyipada ifaworanhan rẹ. |
Ipilẹ kan, ohun itanna ti o gbooro ni irọrun fun ṣiṣẹda ni iyara awọn oriṣi ti o wuyi pẹlu titẹ ọrọ fọọmu eyikeyi.
Ṣe igbasilẹ failiBẹrẹ titẹ ni aaye ti o wa ni isalẹ lati fi awọn abajade iruwe han.
Pe typeahead nipasẹ JavaScript:
- $ ( '.typehead' ). oriṣi ori ()
Oruko | iru | aiyipada | apejuwe |
---|---|---|---|
orisun | orun | [] | Orisun data lati beere lodi si. |
awọn ohun kan | nọmba | 8 | Nọmba ti o pọju awọn ohun kan lati ṣafihan ninu sisọ silẹ. |
baramu | iṣẹ | irú insensitive | Ọna ti a lo lati pinnu boya ibeere kan ba nkan kan mu. Gba ariyanjiyan ẹyọkan, item lodi si eyiti lati ṣe idanwo ibeere naa. Wọle si ibeere lọwọlọwọ pẹlu this.query . Da boolean pada true ti ibeere ba jẹ baramu. |
lẹsẹsẹ | iṣẹ | baramu gangan, ọran ifarabalẹ, ọran aibikita |
Ọna ti a lo lati to awọn abajade pipe laifọwọyi. Gba ariyanjiyan ẹyọkan items ati pe o ni aaye ti apẹẹrẹ iruhead. Tọkasi ibeere lọwọlọwọ pẹlu this.query . |
afihan | iṣẹ | ṣe afihan gbogbo awọn ibaamu aiyipada | Ọna ti a lo lati ṣe afihan awọn abajade adaṣe. Gba ariyanjiyan ẹyọkan item ati pe o ni aaye ti apẹẹrẹ iruhead. O yẹ ki o pada html. |
Ṣafikun awọn abuda data lati forukọsilẹ nkan kan pẹlu iṣẹ ṣiṣe oriṣi.
- <input type = "text" data-provide = "typeahead" >
Ti bẹrẹ titẹ sii pẹlu ori oriṣi.