Javascript fun Bootstrap

Mu awọn paati Bootstrap wa si igbesi aye pẹlu titun, awọn afikun aṣa ti o ṣiṣẹ pẹlu jQuery ati Ender .

← Pada si ile Bootstrap

Ohun itanna yii jẹ fun fifi scrollspy (nav imudojuiwọn adaṣe laifọwọyi) ibaraenisepo si topbar bootstrap.

Gba lati ayelujara

Lilo bootstrap-scrollspy.js

  1. $ ( '#topbar' ). scrollSpy ()

Siṣamisi

Lati ni irọrun ṣafikun ihuwasi scrollspy si nav rẹ, kan ṣafikun ikasi si data-scrollspyfaili .topbar.

  1. <div class = "topbar" data-scrollspy = "scrollspy" > ... </div>

Awọn ọna

$().scrollSpy()

Aifọwọyi mu awọn bọtini lilọ kiri ṣiṣẹ nipasẹ awọn olumulo yi lọ si ipo.

  1. $ ( 'ara> .topbar' ). scrollSpy ()

Akiyesi Topbar oran afi gbọdọ ni awọn ibi-afẹde id ti o yanju. Fun apẹẹrẹ, a <a href="#home">home</a>gbọdọ ba nkan ṣe ni dom bi <div id="home"></div>.

.scrollSpy('itura')

The scrollspy caches nav bọtini ati ki o apakan ipoidojuko fun išẹ. Ti o ba nilo lati ṣe imudojuiwọn kaṣe yii (o ṣeeṣe ti o ba ni akoonu ti o ni agbara) kan pe ọna isọdọtun yii. Ti o ba lo awọn abuda data lati setumo rẹ scrollspy, o kan pe Sọ lori ara.

  1. $ ( 'ara' ). scrollSpy ( 'itura' )

Ririnkiri

Ṣayẹwo awọn topbar lilọ lori iwe yi.

Ohun itanna yii nfunni ni iṣẹ ṣiṣe afikun fun ṣiṣakoso ipo bọtini.

Gba lati ayelujara

Lilo bootstrap-buttons.js

  1. $ ( '. awọn taabu' ). bọtini ()

Awọn ọna

$()bọtini ('yipo')

Toggles titari ipinle. O fun btn ni oju ti o ti muu ṣiṣẹ.

Akiyesi O le mu yiyi pada laifọwọyi ti bọtini kan nipa lilo data-toggleabuda naa.

  1. <bọtini kilasi = "btn" data-toggle = "yipada" > ... </button>

$().bọtini('ikojọpọ')

Ṣeto ipo bọtini si ikojọpọ - mu bọtini ṣiṣẹ ati yi ọrọ pada si ọrọ ikojọpọ. Ọrọ ikojọpọ yẹ ki o ṣalaye lori bọtini bọtini ni lilo abuda data data-loading-text.

  1. <button class = "btn" data-loading-text = "ikojọpọ nkan..." > ... </button>

$().bọtini('tunto')

Tun ipo bọtini atunto - yi ọrọ pada si ọrọ atilẹba.

$().bọtini (okun)

Tun ipo bọtini atunto - yi ọrọ pada si eyikeyi ipo ọrọ asọye data.

  1. <button class = "btn" data-complete-text = "pari!" > ... </bọtini>
  2. <akosile>
  3. $('.btn').bọtini ('pari')
  4. </scrip>

Ririnkiri

Ohun itanna yii ṣe afikun iyara, taabu agbara ati iṣẹ ṣiṣe egbogi.

Gba lati ayelujara

Lilo bootstrap-tabs.js

  1. $ ( '. awọn taabu' ). awọn taabu ()

Siṣamisi

O le mu taabu kan ṣiṣẹ tabi lilọ kiri egbogi laisi kikọ eyikeyi JavaScript nipa fifun wọn ni lasan data-tabstabi data-pillsikalara.

  1. <ul class = "awọn taabu" data-tabs = "awọn taabu" > ... </ul>

Awọn ọna

$ () awọn taabu tabi $ () . ìşọmọbí

Mu taabu ṣiṣẹ ati iṣẹ ṣiṣe egbogi fun eiyan ti a fun. Awọn ọna asopọ taabu yẹ ki o tọka id's ninu iwe-ipamọ naa.

  1. <ul kilasi = "awọn taabu" >
  2. <li class = "lọwọ" ><a href = "#ile" > Ile </a></li>
  3. <li > <a href = "#profaili"> Profaili </a></li>
  4. <li><a href = "#messages" > Awọn ifiranṣẹ </a></li>
  5. <li><a href = "#eto" > Eto </a></li>
  6. </ul>
  7.  
  8. <div class = "akoonu-pill" >
  9. <div class = "lọwọ" id = "ile" > ... </div>
  10. <div id = "profaili" > ... </div>
  11. <div id = "awọn ifiranṣẹ" > ... </div>
  12. <div id = "awọn eto" > ... </div>
  13. </div>
  14.  
  15. <akosile>
  16. $ ( iṣẹ () {
  17. $ ( '. awọn taabu' ). awọn taabu ()
  18. })
  19. </script>

Awọn iṣẹlẹ

Iṣẹlẹ Apejuwe
yipada Iṣẹlẹ yi ina lori iyipada taabu. Lo event.targetati event.relatedTargetlati dojukọ taabu ti nṣiṣe lọwọ ati taabu iṣẹ iṣaaju tẹlẹ lẹsẹsẹ.
  1. $ ( '#. awọn taabu' ). ( 'iyipada' , iṣẹ ( e ) {
  2. e . afojusun // mu ṣiṣẹ taabu
  3. e . jẹmọTarget // ti tẹlẹ taabu
  4. })

Ririnkiri

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.

Banksy do proident, brooklyn photo booth delectus sunt artisan sed organic exercitation eiusmod four loko. Quis tattooed iphone esse aliqua. Master cleanse vero fixie mcsweeney's. Ethical portland aute, irony food truck pitchfork lomo eu anim. Aesthetic blog DIY, ethical beard leggings tofu consequat whatever cardigan nostrud. Helvetica you probably haven't heard of them carles, marfa veniam occaecat lomo before they sold out in shoreditch scenester sustainable thundercats. Consectetur tofu craft beer, mollit brunch fap echo park pitchfork mustache dolor.

Sunt qui biodiesel mollit officia, fanny pack put a bird on it thundercats seitan squid ad wolf bicycle rights blog. Et aute readymade farm-to-table carles 8-bit, nesciunt nulla etsy adipisicing organic ea. Master cleanse mollit high life, next level Austin nesciunt american apparel twee mustache adipisicing reprehenderit hoodie portland irony. Aliqua tofu quinoa +1 commodo eiusmod. High life williamsburg cupidatat twee homo leggings. Four loko vinyl DIY consectetur nisi, marfa retro keffiyeh vegan. Fanny pack viral retro consectetur gentrify fap.

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.

Da lori ohun itanna jQuery.tipsy ti o dara julọ ti Jason Frame kọ; twipsy jẹ ẹya imudojuiwọn, eyiti ko gbẹkẹle awọn aworan, nlo css3 fun awọn ohun idanilaraya, ati awọn abuda data fun ibi ipamọ akọle!

Gba lati ayelujara

Lilo bootstrap-twipsy.js

  1. $ ( '#apẹẹrẹ' ). twipsy ( awọn aṣayan )

Awọn aṣayan

Oruko iru aiyipada apejuwe
iwara boolian ooto lo iyipada css ipare si ọpa irinṣẹ
idaduroIn nọmba 0 idaduro ṣaaju ki o to ṣe afihan ọpa irinṣẹ (ms)
idaduroJade nọmba 0 idaduro ṣaaju ki o to tọju awọn ohun elo irinṣẹ (ms)
isubu okun '' ọrọ lati lo nigbati ko si akọle irinṣẹ
ipo okun 'loke' bi o si ipo awọn Tooltip - loke | ni isalẹ | osi | ọtun
html boolian eke faye gba akoonu html laarin ọpa irinṣẹ
gbe boolian eke lo aṣoju iṣẹlẹ dipo awọn olutọju iṣẹlẹ kọọkan
aiṣedeede nọmba 0 piksẹli aiṣedeede ti ọpa irinṣẹ lati ibi-afẹde
akọle okun, iṣẹ 'akọle' abuda tabi ọna fun gbigba ọrọ akọle pada
okunfa okun 'rababa' bi o ti wa ni jeki irinṣẹ - rababa | idojukọ | Afowoyi
awoṣe okun [iṣamisi aiyipada] Awoṣe HTML ti a lo fun ṣiṣe twipsy kan.

Akiyesi Awọn aṣayan apẹẹrẹ twipsy kọọkan le jẹ iyasọtọ nipasẹ lilo awọn abuda data.

  1. <a href = "#" data-placement = "isalẹ" rel = 'twipsy' akọle = 'Awọn ọrọ akọle diẹ' > ọrọ </a>

Awọn ọna

$().twipsy(awọn aṣayan)

So oluṣakoso twipsy kan si ikojọpọ eroja.

.twipsy('ifihan')

Ṣe afihan awọn eroja twipsy kan.

  1. $ ( '# ano' ). twipsy ( 'ifihan' )

.twipsy('tọju')

Ìbòmọlẹ ohun eroja twipsy.

  1. $ ( '# ano' ). twipsy ( 'tọju' )

.twipsy(otitọ)

Pada ohun eroja twipsy kilasi apeere.

  1. $ ( '# ano' ). twipsy ( otitọ )

Akiyesi Ni omiiran, eyi le ṣe gba pada pẹlu $().data('twipsy').

Ririnkiri

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 ohunkohun ti keytar, scenester oko-to-tabili banksy Austin twitter mu freegan cred aise Denimu nikan-Oti kofi gbogun ti.

Ohun itanna agbejade n pese wiwo ti o rọrun fun fifi awọn agbejade kun si ohun elo rẹ. O ṣe afikun ohun itanna bootstrap-twipsy.js , nitorinaa rii daju pe o gba faili yẹn daradara nigbati o ba pẹlu awọn agbejade ninu iṣẹ akanṣe rẹ!

Akiyesi O gbọdọ ni faili bootstrap-twipsy.js ṣaaju bootstrap-popover.js.

Gba lati ayelujara

Lilo bootstrap-popover.js

  1. $ ( '#apẹẹrẹ' ). popover ( awọn aṣayan )

Awọn aṣayan

Oruko iru aiyipada apejuwe
iwara boolian ooto lo iyipada css ipare si ọpa irinṣẹ
idaduroIn nọmba 0 idaduro ṣaaju ki o to ṣe afihan ọpa irinṣẹ (ms)
idaduroJade nọmba 0 idaduro ṣaaju ki o to tọju awọn ohun elo irinṣẹ (ms)
isubu okun '' ọrọ lati lo nigbati ko si akọle irinṣẹ
ipo okun 'ọtun' bi o si ipo awọn Tooltip - loke | ni isalẹ | osi | ọtun
html boolian eke faye gba akoonu html laarin ọpa irinṣẹ
gbe boolian eke lo aṣoju iṣẹlẹ dipo awọn olutọju iṣẹlẹ kọọkan
aiṣedeede nọmba 0 piksẹli aiṣedeede ti ọpa irinṣẹ lati ibi-afẹde
akọle okun, iṣẹ 'akọle' abuda tabi ọna fun gbigba ọrọ akọle pada
akoonu okun, iṣẹ 'data-akoonu' okun tabi ọna fun gbigba ọrọ akoonu pada. ti ko ba si ọkan ti a pese, akoonu yoo jẹ orisun lati ẹya-ara akoonu data kan.
okunfa okun 'rababa' bi o ti wa ni jeki irinṣẹ - rababa | idojukọ | Afowoyi
awoṣe okun [iṣamisi aiyipada] Awoṣe HTML ti a lo fun ṣiṣe agbejade kan.

Akiyesi Awọn aṣayan apẹẹrẹ popover kọọkan le jẹ iyasọtọ nipasẹ lilo awọn abuda data.

  1. <a data-placement = "isalẹ" href = "#" kilasi = "btn danger" rel = "popover" > ọrọ </a>

Awọn ọna

$().popover(awọn aṣayan)

Initializes popovers fun ohun akojọpọ eroja.

.popover('ifihan')

Ṣe afihan awọn eroja popover.

  1. $ ( '# ano' ). popover ( 'ifihan' )

.popover('tọju')

Ìbòmọlẹ ohun eroja popover.

  1. $ ( '# ano' ). popover ( 'tọju' )

Ririnkiri

rababa fun popover

Ohun itanna gbigbọn jẹ kilasi kekere ti o ga julọ fun fifi iṣẹ ṣiṣe sunmọ si awọn titaniji.

Gba lati ayelujara

Lilo bootstrap-alerts.js

  1. $ ( ". Ifiranṣẹ-itaniji " ). gbigbọn ()

Siṣamisi

Kan ṣafikun data-alertẹda kan si awọn ifiranṣẹ itaniji rẹ lati fun wọn ni iṣẹ ṣiṣe isunmọ laifọwọyi.

Awọn aṣayan

Oruko iru aiyipada apejuwe
yiyan okun '.sunmọ' Ohun ti o yan lati fojusi fun pipade itaniji.

Awọn ọna

$() titaniji()

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 .fadeati .inkilasi ti lo tẹlẹ si wọn.

.titaniji('sunmọ')

Tilekun itaniji.

  1. $ ( ". Ifiranṣẹ-itaniji " ). gbigbọn ( 'sunmọ' )

Ririnkiri

×

Guacamole mimọ! Ṣayẹwo ararẹ ti o dara julọ, iwọ ko dara ju.

×

Oh imolara! O ni aṣiṣe! 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.