1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00

Convert JS page to pygments; nuke prettify assets

This commit is contained in:
Mark Otto 2013-02-14 22:33:26 -08:00
parent 37becbab8c
commit 979ca4ea7a
5 changed files with 332 additions and 285 deletions

View file

@ -17,7 +17,6 @@
<!-- Documentation extras --> <!-- Documentation extras -->
<link href="/assets/css/docs.css" rel="stylesheet"> <link href="/assets/css/docs.css" rel="stylesheet">
<link href="/assets/css/pygments-manni.css" rel="stylesheet"> <link href="/assets/css/pygments-manni.css" rel="stylesheet">
<link href="/assets/js/google-code-prettify/prettify.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]> <!--[if lt IE 9]>

View file

@ -6,8 +6,8 @@
.o { color: #555555 } /* Operator */ .o { color: #555555 } /* Operator */
.cm { color: #0099FF; font-style: italic } /* Comment.Multiline */ .cm { color: #0099FF; font-style: italic } /* Comment.Multiline */
.cp { color: #009999 } /* Comment.Preproc */ .cp { color: #009999 } /* Comment.Preproc */
.c1 { color: #0099FF; font-style: italic } /* Comment.Single */ .c1 { color: #999; } /* Comment.Single */
.cs { color: #0099FF;; font-style: italic } /* Comment.Special */ .cs { color: #999; } /* Comment.Special */
.gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */ .gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */
.ge { font-style: italic } /* Generic.Emph */ .ge { font-style: italic } /* Generic.Emph */
.gr { color: #FF0000 } /* Generic.Error */ .gr { color: #FF0000 } /* Generic.Error */

View file

@ -1,30 +0,0 @@
.com { color: #93a1a1; }
.lit { color: #195f91; }
.pun, .opn, .clo { color: #93a1a1; }
.fun { color: #dc322f; }
.str, .atv { color: #D14; }
.kwd, .prettyprint .tag { color: #1e347b; }
.typ, .atn, .dec, .var { color: teal; }
.pln { color: #48484c; }
.prettyprint {
padding: 8px;
background-color: #f7f7f9;
border: 1px solid #e1e1e8;
}
.prettyprint.linenums {
-webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
-moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
margin: 0 0 0 40px; /* IE indents via margin-left */
}
ol.linenums li {
padding-left: 12px;
color: #bebec5;
line-height: 20px;
text-shadow: 0 1px 0 #fff;
}

View file

@ -1,28 +0,0 @@
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();

View file

@ -52,38 +52,47 @@ title: JavaScript plugins
<p>You can use all Bootstrap plugins purely through the markup API without writing a single line of JavaScript. This is Bootstrap's first class API and should be your first consideration when using a plugin.</p> <p>You can use all Bootstrap plugins purely through the markup API without writing a single line of JavaScript. This is Bootstrap's first class API and should be your first consideration when using a plugin.</p>
<p>That said, in some situations it may be desirable to turn this functionality off. Therefore, we also provide the ability to disable the data attribute API by unbinding all events on the body namespaced with `'data-api'`. This looks like this: <p>That said, in some situations it may be desirable to turn this functionality off. Therefore, we also provide the ability to disable the data attribute API by unbinding all events on the body namespaced with `'data-api'`. This looks like this:
<pre class="prettyprint linenums">$('body').off('.data-api')</pre> {% highlight js linenos %}
$('body').off('.data-api')
{% endhighlight %}
<p>Alternatively, to target a specific plugin, just include the plugin's name as a namespace along with the data-api namespace like this:</p> <p>Alternatively, to target a specific plugin, just include the plugin's name as a namespace along with the data-api namespace like this:</p>
<pre class="prettyprint linenums">$('body').off('.alert.data-api')</pre> {% highlight js linenos %}
$('body').off('.alert.data-api')
{% endhighlight %}
<h3>Programmatic API</h3> <h3>Programmatic API</h3>
<p>We also believe you should be able to use all Bootstrap plugins purely through the JavaScript API. All public APIs are single, chainable methods, and return the collection acted upon.</p> <p>We also believe you should be able to use all Bootstrap plugins purely through the JavaScript API. All public APIs are single, chainable methods, and return the collection acted upon.</p>
<pre class="prettyprint linenums">$(".btn.danger").button("toggle").addClass("fat")</pre> {% highlight js linenos %}
$(".btn.danger").button("toggle").addClass("fat")
{% endhighlight %}
<p>All methods should accept an optional options object, a string which targets a particular method, or nothing (which initiates a plugin with default behavior):</p> <p>All methods should accept an optional options object, a string which targets a particular method, or nothing (which initiates a plugin with default behavior):</p>
<pre class="prettyprint linenums"> {% highlight js linenos %}
$("#myModal").modal() // initialized with defaults $("#myModal").modal() // initialized with defaults
$("#myModal").modal({ keyboard: false }) // initialized with no keyboard $("#myModal").modal({ keyboard: false }) // initialized with no keyboard
$("#myModal").modal('show') // initializes and invokes show immediately</p> $("#myModal").modal('show') // initializes and invokes show immediately</p>
</pre> {% endhighlight %}
<p>Each plugin also exposes its raw constructor on a `Constructor` property: <code>$.fn.popover.Constructor</code>. If you'd like to get a particular plugin instance, retrieve it directly from an element: <code>$('[rel=popover]').data('popover')</code>.</p> <p>Each plugin also exposes its raw constructor on a `Constructor` property: <code>$.fn.popover.Constructor</code>. If you'd like to get a particular plugin instance, retrieve it directly from an element: <code>$('[rel=popover]').data('popover')</code>.</p>
<h3>No conflict</h3> <h3>No conflict</h3>
<p>Sometimes it is necessary to use Bootstrap plugins with other UI frameworks. In these circumstances, namespace collisions can occasionally occur. If this happens, you may call <code>.noConflict</code> on the plugin you wish to revert the value of.</p> <p>Sometimes it is necessary to use Bootstrap plugins with other UI frameworks. In these circumstances, namespace collisions can occasionally occur. If this happens, you may call <code>.noConflict</code> on the plugin you wish to revert the value of.</p>
{% highlight js linenos %}
<pre class="prettyprint linenums">
var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value
$.fn.bootstrapBtn = bootstrapButton // give $().bootstrapBtn the bootstrap functionality $.fn.bootstrapBtn = bootstrapButton // give $().bootstrapBtn the bootstrap functionality
</pre> {% endhighlight %}
<h3>Events</h3> <h3>Events</h3>
<p>Bootstrap provides custom events for most plugin's unique actions. Generally, these come in an infinitive and past participle form - where the infinitive (ex. <code>show</code>) is triggered at the start of an event, and its past participle form (ex. <code>shown</code>) is trigger on the completion of an action.</p> <p>Bootstrap provides custom events for most plugin's unique actions. Generally, these come in an infinitive and past participle form - where the infinitive (ex. <code>show</code>) is triggered at the start of an event, and its past participle form (ex. <code>shown</code>) is trigger on the completion of an action.</p>
<p>All infinitive events provide <code>preventDefault</code> functionality. This provides the ability to stop the execution of an action before it starts.</p> <p>All infinitive events provide <code>preventDefault</code> functionality. This provides the ability to stop the execution of an action before it starts.</p>
<pre class="prettyprint linenums"> {% highlight js linenos %}
$('#myModal').on('show', function (e) { $('#myModal').on('show', function (e) {
if (!data) return e.preventDefault() // stops modal from being shown if (!data) return e.preventDefault() // stops modal from being shown
}) })
</pre> {% endhighlight %}
</section> </section>
@ -124,7 +133,6 @@ $('#myModal').on('show', function (e) {
<h3>Static example</h3> <h3>Static example</h3>
<p>A rendered modal with header, body, and set of actions in the footer.</p> <p>A rendered modal with header, body, and set of actions in the footer.</p>
<div class="bs-docs-example bs-docs-example-modal"> <div class="bs-docs-example bs-docs-example-modal">
<div class="modal"> <div class="modal">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
@ -142,29 +150,26 @@ $('#myModal').on('show', function (e) {
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dalog --> </div><!-- /.modal-dalog -->
</div><!-- /.modal --> </div><!-- /.modal -->
</div><!-- /example --> </div><!-- /example -->
<pre class="prettyprint linenums"> {% highlight html linenos %}
&lt;div class="modal fade"&gt; <div class="modal">
&lt;div class="modal-dialog"&gt; <div class="modal-dialog">
&lt;div class="modal-content"&gt; <div class="modal-content">
<div class="modal-header">
&lt;div class="modal-header"&gt; <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
&lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;&amp;times;&lt;/button&gt; <h4 class="modal-title">Modal title</h4>
&lt;h4 class="modal-title"&gt;Modal title&lt;/h4&gt; </div>
&lt;/div&gt; <div class="modal-body">
&lt;div class="modal-body"&gt; <p>One fine body&hellip;</p>
&lt;p&gt;One fine body&hellip;&lt;/p&gt; </div>
&lt;/div&gt; <div class="modal-footer">
&lt;div class="modal-footer"&gt; <a href="#" class="btn">Close</a>
&lt;a href="#" class="btn"&gt;Close&lt;/a&gt; <a href="#" class="btn btn-primary">Save changes</a>
&lt;a href="#" class="btn btn-primary"&gt;Save changes&lt;/a&gt; </div>
&lt;/div&gt; </div><!-- /.modal-content -->
</div><!-- /.modal-dalog -->
&lt;/div&gt; </div><!-- /.modal -->
&lt;/div&gt; {% endhighlight %}
&lt;/div&gt;
</pre>
<h3>Live demo</h3> <h3>Live demo</h3>
<p>Toggle a modal via JavaScript by clicking the button below. It will slide down and fade in from the top of the page.</p> <p>Toggle a modal via JavaScript by clicking the button below. It will slide down and fade in from the top of the page.</p>
@ -209,42 +214,43 @@ $('#myModal').on('show', function (e) {
<div class="bs-docs-example" style="padding-bottom: 24px;"> <div class="bs-docs-example" style="padding-bottom: 24px;">
<a data-toggle="modal" href="#myModal" class="btn btn-primary btn-large">Launch demo modal</a> <a data-toggle="modal" href="#myModal" class="btn btn-primary btn-large">Launch demo modal</a>
</div><!-- /example --> </div><!-- /example -->
<pre class="prettyprint linenums"> {% highlight html linenos %}
&lt!-- Button to trigger modal --&gt; <div class="modal">
&lt;a href="#myModal" role="button" class="btn" data-toggle="modal"&gt;Launch demo modal&lt;/a&gt; <!-- Button trigger modal -->
<a data-toggle="modal" href="#myModal" class="btn btn-primary btn-large">Launch demo modal</a>
&lt!-- Modal --&gt; <!-- Modal -->
&lt;div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt; <div class="modal-dialog">
&lt;div class="modal-dialog"&gt; <div class="modal-content">
&lt;div class="modal-content"&gt; <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
&lt;div class="modal-header"&gt; <h4 class="modal-title">Modal title</h4>
&lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;&amp;times;&lt;/button&gt; </div>
&lt;h4 class="modal-title"&gt;Modal title&lt;/h4&gt; <div class="modal-body">
&lt;/div&gt;
&lt;div class="modal-body"&gt;
... ...
&lt;/div&gt; </div>
&lt;div class="modal-footer"&gt; <div class="modal-footer">
&lt;a href="#" class="btn"&gt;Close&lt;/a&gt; <a href="#" class="btn">Close</a>
&lt;a href="#" class="btn btn-primary"&gt;Save changes&lt;/a&gt; <a href="#" class="btn btn-primary">Save changes</a>
&lt;/div&gt; </div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dalog -->
</div><!-- /.modal -->
{% endhighlight %}
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</pre>
<h2>Usage</h2> <h2>Usage</h2>
<h3>Via data attributes</h3> <h3>Via data attributes</h3>
<p>Activate a modal without writing JavaScript. Set <code>data-toggle="modal"</code> on a controller element, like a button, along with a <code>data-target="#foo"</code> or <code>href="#foo"</code> to target a specific modal to toggle.</p> <p>Activate a modal without writing JavaScript. Set <code>data-toggle="modal"</code> on a controller element, like a button, along with a <code>data-target="#foo"</code> or <code>href="#foo"</code> to target a specific modal to toggle.</p>
<pre class="prettyprint linenums">&lt;button type="button" data-toggle="modal" data-target="#myModal"&gt;Launch modal&lt;/button&gt;</pre> {% highlight html linenos %}
<button type="button" data-toggle="modal" data-target="#myModal">Launch modal</button>
{% endhighlight %}
<h3>Via JavaScript</h3> <h3>Via JavaScript</h3>
<p>Call a modal with id <code>myModal</code> with a single line of JavaScript:</p> <p>Call a modal with id <code>myModal</code> with a single line of JavaScript:</p>
<pre class="prettyprint linenums">$('#myModal').modal(options)</pre> {% highlight js linenos %}$('#myModal').modal(options){% endhighlight %}
<h3>Options</h3> <h3>Options</h3>
<p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-backdrop=""</code>.</p> <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-backdrop=""</code>.</p>
@ -281,28 +287,35 @@ $('#myModal').on('show', function (e) {
<td>path</td> <td>path</td>
<td>false</td> <td>false</td>
<td><p>If a remote url is provided, content will be loaded via jQuery's <code>load</code> method and injected into the <code>.modal-body</code>. If you're using the data api, you may alternatively use the <code>href</code> tag to specify the remote source. An example of this is shown below:</p> <td><p>If a remote url is provided, content will be loaded via jQuery's <code>load</code> method and injected into the <code>.modal-body</code>. If you're using the data api, you may alternatively use the <code>href</code> tag to specify the remote source. An example of this is shown below:</p>
<pre class="prettyprint linenums"><code>&lt;a data-toggle="modal" href="remote.html" data-target="#modal"&gt;click me&lt;/a&gt;</code></pre></td> {% highlight html linenos %}
<a data-toggle="modal" href="remote.html" data-target="#modal">Click me</a>
{% endhighlight %}
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3>Methods</h3> <h3>Methods</h3>
<h4>.modal(options)</h4> <h4>.modal(options)</h4>
<p>Activates your content as a modal. Accepts an optional options <code>object</code>.</p> <p>Activates your content as a modal. Accepts an optional options <code>object</code>.</p>
<pre class="prettyprint linenums"> {% highlight js linenos %}
$('#myModal').modal({ $('#myModal').modal({
keyboard: false keyboard: false
}) })
</pre> {% endhighlight %}
<h4>.modal('toggle')</h4> <h4>.modal('toggle')</h4>
<p>Manually toggles a modal.</p> <p>Manually toggles a modal.</p>
<pre class="prettyprint linenums">$('#myModal').modal('toggle')</pre> {% highlight js linenos %}$('#myModal').modal('toggle'){% endhighlight %}
<h4>.modal('show')</h4> <h4>.modal('show')</h4>
<p>Manually opens a modal.</p> <p>Manually opens a modal.</p>
<pre class="prettyprint linenums">$('#myModal').modal('show')</pre> {% highlight js linenos %}$('#myModal').modal('show'){% endhighlight %}
<h4>.modal('hide')</h4> <h4>.modal('hide')</h4>
<p>Manually hides a modal.</p> <p>Manually hides a modal.</p>
<pre class="prettyprint linenums">$('#myModal').modal('hide')</pre> {% highlight js linenos %}$('#myModal').modal('hide'){% endhighlight %}
<h3>Events</h3> <h3>Events</h3>
<p>Bootstrap's modal class exposes a few events for hooking into modal functionality.</p> <p>Bootstrap's modal class exposes a few events for hooking into modal functionality.</p>
<table class="table table-bordered table-striped"> <table class="table table-bordered table-striped">
@ -331,11 +344,11 @@ $('#myModal').modal({
</tr> </tr>
</tbody> </tbody>
</table> </table>
<pre class="prettyprint linenums"> {% highlight js linenos %}
$('#myModal').on('hidden', function () { $('#myModal').on('hidden', function () {
// do something… // do something…
}) })
</pre> {% endhighlight %}
</section> </section>
@ -441,30 +454,31 @@ $('#myModal').on('hidden', function () {
<h3>Via data attributes</h3> <h3>Via data attributes</h3>
<p>Add <code>data-toggle="dropdown"</code> to a link or button to toggle a dropdown.</p> <p>Add <code>data-toggle="dropdown"</code> to a link or button to toggle a dropdown.</p>
<pre class="prettyprint linenums"> {% highlight html linenos %}
&lt;div class="dropdown"&gt; <div class="dropdown">
&lt;a class="dropdown-toggle" data-toggle="dropdown" href="#"&gt;Dropdown trigger&lt;/a&gt; <a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown trigger</a>
&lt;ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"&gt; <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
... ...
&lt;/ul&gt; </ul>
&lt;/div&gt; </div>
</pre> {% endhighlight %}
<p>To keep URLs intact, use the <code>data-target</code> attribute instead of <code>href="#"</code>.</p> <p>To keep URLs intact, use the <code>data-target</code> attribute instead of <code>href="#"</code>.</p>
<pre class="prettyprint linenums"> {% highlight html linenos %}
&lt;div class="dropdown"&gt; <div class="dropdown">
&lt;a class="dropdown-toggle" id="dLabel" role="button" data-toggle="dropdown" data-target="#" href="/page.html"&gt; <a class="dropdown-toggle" id="dLabel" role="button" data-toggle="dropdown" data-target="#" href="/page.html">
Dropdown Dropdown <span class="caret"></span>
&lt;b class="caret"&gt;&lt;/b&gt; </a>
&lt;/a&gt; <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
&lt;ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"&gt;
... ...
&lt;/ul&gt; </ul>
&lt;/div&gt; </div>
</pre> {% endhighlight %}
<h3>Via JavaScript</h3> <h3>Via JavaScript</h3>
<p>Call the dropdowns via JavaScript:</p> <p>Call the dropdowns via JavaScript:</p>
<pre class="prettyprint linenums">$('.dropdown-toggle').dropdown()</pre> {% highlight js linenos %}
$('.dropdown-toggle').dropdown()
{% endhighlight %}
<h3>Options</h3> <h3>Options</h3>
<p><em>None</em></p> <p><em>None</em></p>
@ -531,11 +545,17 @@ $('#myModal').on('hidden', function () {
<h3>Via data attributes</h3> <h3>Via data attributes</h3>
<p>To easily add scrollspy behavior to your topbar navigation, just add <code>data-spy="scroll"</code> to the element you want to spy on (most typically this would be the body) and <code>data-target=".navbar"</code> to select which nav to use. You'll want to use scrollspy with a <code>.nav</code> component.</p> <p>To easily add scrollspy behavior to your topbar navigation, just add <code>data-spy="scroll"</code> to the element you want to spy on (most typically this would be the body) and <code>data-target=".navbar"</code> to select which nav to use. You'll want to use scrollspy with a <code>.nav</code> component.</p>
<pre class="prettyprint linenums">&lt;body data-spy="scroll" data-target=".navbar"&gt;...&lt;/body&gt;</pre> {% highlight html linenos %}
<body data-spy="scroll" data-target=".navbar">
...
</body>
{% endhighlight %}
<h3>Via JavaScript</h3> <h3>Via JavaScript</h3>
<p>Call the scrollspy via JavaScript:</p> <p>Call the scrollspy via JavaScript:</p>
<pre class="prettyprint linenums">$('#navbar').scrollspy()</pre> {% highlight js linenos %}
$('#navbar').scrollspy()
{% endhighlight %}
<div class="alert alert-info"> <div class="alert alert-info">
<strong>Heads up!</strong> <strong>Heads up!</strong>
@ -545,11 +565,12 @@ $('#myModal').on('hidden', function () {
<h3>Methods</h3> <h3>Methods</h3>
<h4>.scrollspy('refresh')</h4> <h4>.scrollspy('refresh')</h4>
<p>When using scrollspy in conjunction with adding or removing of elements from the DOM, you'll need to call the refresh method like so:</p> <p>When using scrollspy in conjunction with adding or removing of elements from the DOM, you'll need to call the refresh method like so:</p>
<pre class="prettyprint linenums"> {% highlight js linenos %}
$('[data-spy="scroll"]').each(function () { $('[data-spy="scroll"]').each(function () {
var $spy = $(this).scrollspy('refresh') var $spy = $(this).scrollspy('refresh')
}); });
</pre> {% endhighlight %}
<h3>Options</h3> <h3>Options</h3>
<p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-offset=""</code>.</p> <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-offset=""</code>.</p>
@ -635,28 +656,32 @@ $('[data-spy="scroll"]').each(function () {
<h2>Usage</h2> <h2>Usage</h2>
<p>Enable tabbable tabs via JavaScript (each tab needs to be activated individually):</p> <p>Enable tabbable tabs via JavaScript (each tab needs to be activated individually):</p>
<pre class="prettyprint linenums"> {% highlight js linenos %}
$('#myTab a').click(function (e) { $('#myTab a').click(function (e) {
e.preventDefault(); e.preventDefault();
$(this).tab('show'); $(this).tab('show');
})</pre> })
{% endhighlight %}
<p>You can activate individual tabs in several ways:</p> <p>You can activate individual tabs in several ways:</p>
<pre class="prettyprint linenums"> {% highlight js linenos %}
$('#myTab a[href="#profile"]').tab('show'); // Select tab by name $('#myTab a[href="#profile"]').tab('show'); // Select tab by name
$('#myTab a:first').tab('show'); // Select first tab $('#myTab a:first').tab('show'); // Select first tab
$('#myTab a:last').tab('show'); // Select last tab $('#myTab a:last').tab('show'); // Select last tab
$('#myTab li:eq(2) a').tab('show'); // Select third tab (0-indexed) $('#myTab li:eq(2) a').tab('show'); // Select third tab (0-indexed)
</pre> {% endhighlight %}
<h3>Markup</h3> <h3>Markup</h3>
<p>You can activate a tab or pill navigation without writing any JavaScript by simply specifying <code>data-toggle="tab"</code> or <code>data-toggle="pill"</code> on an element. Adding the <code>nav</code> and <code>nav-tabs</code> classes to the tab <code>ul</code> will apply the Bootstrap tab styling.</p> <p>You can activate a tab or pill navigation without writing any JavaScript by simply specifying <code>data-toggle="tab"</code> or <code>data-toggle="pill"</code> on an element. Adding the <code>nav</code> and <code>nav-tabs</code> classes to the tab <code>ul</code> will apply the Bootstrap tab styling.</p>
<pre class="prettyprint linenums"> {% highlight html linenos %}
&lt;ul class="nav nav-tabs"&gt; <ul class="nav nav-tabs">
&lt;li&gt;&lt;a href="#home" data-toggle="tab"&gt;Home&lt;/a&gt;&lt;/li&gt; <li><a href="#home" data-toggle="tab">Home</a></li>
&lt;li&gt;&lt;a href="#profile" data-toggle="tab"&gt;Profile&lt;/a&gt;&lt;/li&gt; <li><a href="#profile" data-toggle="tab">Profile</a></li>
&lt;li&gt;&lt;a href="#messages" data-toggle="tab"&gt;Messages&lt;/a&gt;&lt;/li&gt; <li><a href="#messages" data-toggle="tab">Messages</a></li>
&lt;li&gt;&lt;a href="#settings" data-toggle="tab"&gt;Settings&lt;/a&gt;&lt;/li&gt; <li><a href="#settings" data-toggle="tab">Settings</a></li>
&lt;/ul&gt;</pre> </ul>
{% endhighlight %}
<p>To make tabs fade in, add <code>.fade</code> to each <code>.tab-pane</code>.</p> <p>To make tabs fade in, add <code>.fade</code> to each <code>.tab-pane</code>.</p>
<h3>Methods</h3> <h3>Methods</h3>
@ -664,27 +689,27 @@ $('#myTab li:eq(2) a').tab('show'); // Select third tab (0-indexed)
<p> <p>
Activates a tab element and content container. Tab should have either a <code>data-target</code> or an <code>href</code> targeting a container node in the DOM. Activates a tab element and content container. Tab should have either a <code>data-target</code> or an <code>href</code> targeting a container node in the DOM.
</p> </p>
<pre class="prettyprint linenums"> {% highlight html linenos %}
&lt;ul class="nav nav-tabs" id="myTab"&gt; <ul class="nav nav-tabs" id="myTab">
&lt;li class="active"&gt;&lt;a href="#home"&gt;Home&lt;/a&gt;&lt;/li&gt; <li class="active"><a href="#home">Home</a></li>
&lt;li&gt;&lt;a href="#profile"&gt;Profile&lt;/a&gt;&lt;/li&gt; <li><a href="#profile">Profile</a></li>
&lt;li&gt;&lt;a href="#messages"&gt;Messages&lt;/a&gt;&lt;/li&gt; <li><a href="#messages">Messages</a></li>
&lt;li&gt;&lt;a href="#settings"&gt;Settings&lt;/a&gt;&lt;/li&gt; <li><a href="#settings">Settings</a></li>
&lt;/ul&gt; </ul>
&lt;div class="tab-content"&gt; <div class="tab-content">
&lt;div class="tab-pane active" id="home"&gt;...&lt;/div&gt; <div class="tab-pane active" id="home">...</div>
&lt;div class="tab-pane" id="profile"&gt;...&lt;/div&gt; <div class="tab-pane" id="profile">...</div>
&lt;div class="tab-pane" id="messages"&gt;...&lt;/div&gt; <div class="tab-pane" id="messages">...</div>
&lt;div class="tab-pane" id="settings"&gt;...&lt;/div&gt; <div class="tab-pane" id="settings">...</div>
&lt;/div&gt; </div>
&lt;script&gt; <script>
$(function () { $(function () {
$('#myTab a:last').tab('show'); $('#myTab a:last').tab('show');
}) })
&lt;/script&gt; </script>
</pre> {% endhighlight %}
<h3>Events</h3> <h3>Events</h3>
<table class="table table-bordered table-striped"> <table class="table table-bordered table-striped">
@ -705,12 +730,12 @@ $('#myTab li:eq(2) a').tab('show'); // Select third tab (0-indexed)
</tr> </tr>
</tbody> </tbody>
</table> </table>
<pre class="prettyprint linenums"> {% highlight js linenos %}
$('a[data-toggle="tab"]').on('shown', function (e) { $('a[data-toggle="tab"]').on('shown', function (e) {
e.target // activated tab e.target // activated tab
e.relatedTarget // previous tab e.relatedTarget // previous tab
}) })
</pre> {% endhighlight %}
</section> </section>
@ -749,7 +774,9 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
<h2>Usage</h2> <h2>Usage</h2>
<p>Trigger the tooltip via JavaScript:</p> <p>Trigger the tooltip via JavaScript:</p>
<pre class="prettyprint linenums">$('#example').tooltip(options)</pre> {% highlight js linenos %}
$('#example').tooltip(options)
{% endhighlight %}
<h3>Options</h3> <h3>Options</h3>
<p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-animation=""</code>.</p> <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-animation=""</code>.</p>
@ -825,23 +852,30 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
</div> </div>
<h3>Markup</h3> <h3>Markup</h3>
<pre class="prettyprint linenums">&lt;a href="#" data-toggle="tooltip" title="first tooltip"&gt;hover over me&lt;/a&gt;</pre> {% highlight html linenos %}
<a href="#" data-toggle="tooltip" title="first tooltip">Hover over me</a>
{% endhighlight %}
<h3>Methods</h3> <h3>Methods</h3>
<h4>$().tooltip(options)</h4> <h4>$().tooltip(options)</h4>
<p>Attaches a tooltip handler to an element collection.</p> <p>Attaches a tooltip handler to an element collection.</p>
<h4>.tooltip('show')</h4> <h4>.tooltip('show')</h4>
<p>Reveals an element's tooltip.</p> <p>Reveals an element's tooltip.</p>
<pre class="prettyprint linenums">$('#element').tooltip('show')</pre> {% highlight js linenos %}$('#element').tooltip('show'){% endhighlight %}
<h4>.tooltip('hide')</h4> <h4>.tooltip('hide')</h4>
<p>Hides an element's tooltip.</p> <p>Hides an element's tooltip.</p>
<pre class="prettyprint linenums">$('#element').tooltip('hide')</pre> {% highlight js linenos %}$('#element').tooltip('hide'){% endhighlight %}
<h4>.tooltip('toggle')</h4> <h4>.tooltip('toggle')</h4>
<p>Toggles an element's tooltip.</p> <p>Toggles an element's tooltip.</p>
<pre class="prettyprint linenums">$('#element').tooltip('toggle')</pre> {% highlight js linenos %}$('#element').tooltip('toggle'){% endhighlight %}
<h4>.tooltip('destroy')</h4> <h4>.tooltip('destroy')</h4>
<p>Hides and destroys an element's tooltip.</p> <p>Hides and destroys an element's tooltip.</p>
<pre class="prettyprint linenums">$('#element').tooltip('destroy')</pre> {% highlight js linenos %}$('#element').tooltip('destroy'){% endhighlight %}
</section> </section>
@ -916,7 +950,7 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
<h2>Usage</h2> <h2>Usage</h2>
<p>Enable popovers via JavaScript:</p> <p>Enable popovers via JavaScript:</p>
<pre class="prettyprint linenums">$('#example').popover(options)</pre> {% highlight js linenos %}$('#example').popover(options){% endhighlight %}
<h3>Options</h3> <h3>Options</h3>
<p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-animation=""</code>.</p> <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-animation=""</code>.</p>
@ -1003,18 +1037,22 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
<h3>Methods</h3> <h3>Methods</h3>
<h4>$().popover(options)</h4> <h4>$().popover(options)</h4>
<p>Initializes popovers for an element collection.</p> <p>Initializes popovers for an element collection.</p>
<h4>.popover('show')</h4> <h4>.popover('show')</h4>
<p>Reveals an elements popover.</p> <p>Reveals an elements popover.</p>
<pre class="prettyprint linenums">$('#element').popover('show')</pre> {% highlight js linenos %}$('#element').popover('show'){% endhighlight %}
<h4>.popover('hide')</h4> <h4>.popover('hide')</h4>
<p>Hides an elements popover.</p> <p>Hides an elements popover.</p>
<pre class="prettyprint linenums">$('#element').popover('hide')</pre> {% highlight js linenos %}$('#element').popover('hide'){% endhighlight %}
<h4>.popover('toggle')</h4> <h4>.popover('toggle')</h4>
<p>Toggles an elements popover.</p> <p>Toggles an elements popover.</p>
<pre class="prettyprint linenums">$('#element').popover('toggle')</pre> {% highlight js linenos %}$('#element').popover('toggle'){% endhighlight %}
<h4>.popover('destroy')</h4> <h4>.popover('destroy')</h4>
<p>Hides and destroys an element's popover.</p> <p>Hides and destroys an element's popover.</p>
<pre class="prettyprint linenums">$('#element').popover('destroy')</pre> {% highlight js linenos %}$('#element').popover('destroy'){% endhighlight %}
</section> </section>
@ -1053,18 +1091,20 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
<h2>Usage</h2> <h2>Usage</h2>
<p>Enable dismissal of an alert via JavaScript:</p> <p>Enable dismissal of an alert via JavaScript:</p>
<pre class="prettyprint linenums">$(".alert").alert()</pre> {% highlight js linenos %}$(".alert").alert(){% endhighlight %}
<h3>Markup</h3> <h3>Markup</h3>
<p>Just add <code>data-dismiss="alert"</code> to your close button to automatically give an alert close functionality.</p> <p>Just add <code>data-dismiss="alert"</code> to your close button to automatically give an alert close functionality.</p>
<pre class="prettyprint linenums">&lt;a class="close" data-dismiss="alert" href="#"&gt;&amp;times;&lt;/a&gt;</pre> {% highlight html linenos %}<a class="close" data-dismiss="alert" href="#">&times;</a>{% endhighlight %}
<h3>Methods</h3> <h3>Methods</h3>
<h4>$().alert()</h4> <h4>$().alert()</h4>
<p>Wraps all alerts with close functionality. To have your alerts animate out when closed, make sure they have the <code>.fade</code> and <code>.in</code> class already applied to them.</p> <p>Wraps all alerts with close functionality. To have your alerts animate out when closed, make sure they have the <code>.fade</code> and <code>.in</code> class already applied to them.</p>
<h4>.alert('close')</h4> <h4>.alert('close')</h4>
<p>Closes an alert.</p> <p>Closes an alert.</p>
<pre class="prettyprint linenums">$(".alert").alert('close')</pre> {% highlight js linenos %}$(".alert").alert('close'){% endhighlight %}
<h3>Events</h3> <h3>Events</h3>
@ -1087,11 +1127,11 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
</tr> </tr>
</tbody> </tbody>
</table> </table>
<pre class="prettyprint linenums"> {% highlight js linenos %}
$('#my-alert').bind('closed', function () { $('#my-alert').bind('closed', function () {
// do something… // do something…
}) })
</pre> {% endhighlight %}
</section> </section>
@ -1109,18 +1149,24 @@ $('#my-alert').bind('closed', function () {
<h4>Stateful</h4> <h4>Stateful</h4>
<p>Add <code>data-loading-text="Loading..."</code> to use a loading state on a button.</p> <p>Add <code>data-loading-text="Loading..."</code> to use a loading state on a button.</p>
<div class="bs-docs-example" style="padding-bottom: 24px;"> <div class="bs-docs-example" style="padding-bottom: 24px;">
<button type="button" id="fat-btn" data-loading-text="loading..." class="btn btn-primary"> <button type="button" id="fat-btn" data-loading-text="Loading..." class="btn btn-primary">
Loading state Loading state
</button> </button>
</div><!-- /example --> </div><!-- /example -->
<pre class="prettyprint linenums">&lt;button type="button" class="btn btn-primary" data-loading-text="Loading..."&gt;Loading state&lt;/button&gt;</pre> {% highlight html linenos %}
<button type="button" id="fat-btn" data-loading-text="Loading..." class="btn btn-primary">
Loading state
</button>
{% endhighlight %}
<h4>Single toggle</h4> <h4>Single toggle</h4>
<p>Add <code>data-toggle="button"</code> to activate toggling on a single button.</p> <p>Add <code>data-toggle="button"</code> to activate toggling on a single button.</p>
<div class="bs-docs-example" style="padding-bottom: 24px;"> <div class="bs-docs-example" style="padding-bottom: 24px;">
<button type="button" class="btn btn-primary" data-toggle="button">Single Toggle</button> <button type="button" class="btn btn-primary" data-toggle="button">Single toggle</button>
</div><!-- /example --> </div><!-- /example -->
<pre class="prettyprint linenums">&lt;button type="button" class="btn btn-primary" data-toggle="button"&gt;Single Toggle&lt;/button&gt;</pre> {% highlight html linenos %}
<button type="button" class="btn btn-primary" data-toggle="button">Single toggle</button>
{% endhighlight %}
<h4>Checkbox</h4> <h4>Checkbox</h4>
<p>Add <code>data-toggle="buttons-checkbox"</code> for checkbox style toggling on btn-group.</p> <p>Add <code>data-toggle="buttons-checkbox"</code> for checkbox style toggling on btn-group.</p>
@ -1131,13 +1177,13 @@ $('#my-alert').bind('closed', function () {
<button type="button" class="btn btn-primary">Right</button> <button type="button" class="btn btn-primary">Right</button>
</div> </div>
</div><!-- /example --> </div><!-- /example -->
<pre class="prettyprint linenums"> {% highlight html linenos %}
&lt;div class="btn-group" data-toggle="buttons-checkbox"&gt; <div class="btn-group" data-toggle="buttons-checkbox">
&lt;button type="button" class="btn btn-primary"&gt;Left&lt;/button&gt; <button type="button" class="btn btn-primary">Left</button>
&lt;button type="button" class="btn btn-primary"&gt;Middle&lt;/button&gt; <button type="button" class="btn btn-primary">Middle</button>
&lt;button type="button" class="btn btn-primary"&gt;Right&lt;/button&gt; <button type="button" class="btn btn-primary">Right</button>
&lt;/div&gt; </div>
</pre> {% endhighlight %}
<h4>Radio</h4> <h4>Radio</h4>
<p>Add <code>data-toggle="buttons-radio"</code> for radio style toggling on btn-group.</p> <p>Add <code>data-toggle="buttons-radio"</code> for radio style toggling on btn-group.</p>
@ -1148,13 +1194,13 @@ $('#my-alert').bind('closed', function () {
<button type="button" class="btn btn-primary">Right</button> <button type="button" class="btn btn-primary">Right</button>
</div> </div>
</div><!-- /example --> </div><!-- /example -->
<pre class="prettyprint linenums"> {% highlight html linenos %}
&lt;div class="btn-group" data-toggle="buttons-radio"&gt; <div class="btn-group" data-toggle="buttons-radio">
&lt;button type="button" class="btn btn-primary"&gt;Left&lt;/button&gt; <button type="button" class="btn btn-primary">Left</button>
&lt;button type="button" class="btn btn-primary"&gt;Middle&lt;/button&gt; <button type="button" class="btn btn-primary">Middle</button>
&lt;button type="button" class="btn btn-primary"&gt;Right&lt;/button&gt; <button type="button" class="btn btn-primary">Right</button>
&lt;/div&gt; </div>
</pre> {% endhighlight %}
<hr class="bs-docs-separator"> <hr class="bs-docs-separator">
@ -1162,7 +1208,9 @@ $('#my-alert').bind('closed', function () {
<h2>Usage</h2> <h2>Usage</h2>
<p>Enable buttons via JavaScript:</p> <p>Enable buttons via JavaScript:</p>
<pre class="prettyprint linenums">$('.nav-tabs').button()</pre> {% highlight js linenos %}
$('.nav-tabs').button()
{% endhighlight %}
<h3>Markup</h3> <h3>Markup</h3>
<p>Data attributes are integral to the button plugin. Check out the example code below for the various markup types.</p> <p>Data attributes are integral to the button plugin. Check out the example code below for the various markup types.</p>
@ -1171,30 +1219,40 @@ $('#my-alert').bind('closed', function () {
<p><em>None</em></p> <p><em>None</em></p>
<h3>Methods</h3> <h3>Methods</h3>
<h4>$().button('toggle')</h4> <h4>$().button('toggle')</h4>
<p>Toggles push state. Gives the button the appearance that it has been activated.</p> <p>Toggles push state. Gives the button the appearance that it has been activated.</p>
<div class="alert alert-info"> <div class="alert alert-info">
<strong>Heads up!</strong> <strong>Heads up!</strong>
You can enable auto toggling of a button by using the <code>data-toggle</code> attribute. You can enable auto toggling of a button by using the <code>data-toggle</code> attribute.
</div> </div>
<pre class="prettyprint linenums">&lt;button type="button" class="btn" data-toggle="button" &gt;&lt;/button&gt;</pre> {% highlight html linenos %}
<button type="button" class="btn" data-toggle="button">...</button>
{% endhighlight %}
<h4>$().button('loading')</h4> <h4>$().button('loading')</h4>
<p>Sets button state to loading - disables button and swaps text to loading text. Loading text should be defined on the button element using the data attribute <code>data-loading-text</code>. <p>Sets button state to loading - disables button and swaps text to loading text. Loading text should be defined on the button element using the data attribute <code>data-loading-text</code>.
</p> </p>
<pre class="prettyprint linenums">&lt;button type="button" class="btn" data-loading-text="loading stuff..." &gt;...&lt;/button&gt;</pre> {% highlight html linenos %}
<button type="button" class="btn" data-loading-text="loading stuff...">...</button>
{% endhighlight %}
<div class="alert alert-info"> <div class="alert alert-info">
<strong>Heads up!</strong> <strong>Heads up!</strong>
<a href="https://github.com/twitter/bootstrap/issues/793">Firefox persists the disabled state across page loads</a>. A workaround for this is to use <code>autocomplete="off"</code>. <a href="https://github.com/twitter/bootstrap/issues/793">Firefox persists the disabled state across page loads</a>. A workaround for this is to use <code>autocomplete="off"</code>.
</div> </div>
<h4>$().button('reset')</h4> <h4>$().button('reset')</h4>
<p>Resets button state - swaps text to original text.</p> <p>Resets button state - swaps text to original text.</p>
<h4>$().button(string)</h4> <h4>$().button(string)</h4>
<p>Resets button state - swaps text to any data defined text state.</p> <p>Resets button state - swaps text to any data defined text state.</p>
<pre class="prettyprint linenums">&lt;button type="button" class="btn" data-complete-text="finished!" &gt;...&lt;/button&gt; {% highlight html linenos %}
&lt;script&gt; <button type="button" class="btn" data-complete-text="finished!" >...</button>
<script>
$('.btn').button('complete') $('.btn').button('complete')
&lt;/script&gt; </script>
</pre> {% endhighlight %}
</section> </section>
@ -1253,43 +1311,55 @@ $('#my-alert').bind('closed', function () {
</div> </div>
</div> </div>
</div><!-- /example --> </div><!-- /example -->
<pre class="prettyprint linenums"> {% highlight html linenos %}
&lt;div class="accordion" id="accordion2"&gt; <div class="accordion" id="accordion2">
&lt;div class="accordion-group"&gt; <div class="accordion-group">
&lt;div class="accordion-heading"&gt; <div class="accordion-heading">
&lt;a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne"&gt; <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Collapsible Group Item #1 Collapsible Group Item #1
&lt;/a&gt; </a>
&lt;/div&gt; </div>
&lt;div id="collapseOne" class="accordion-body collapse in"&gt; <div id="collapseOne" class="accordion-body collapse in">
&lt;div class="accordion-inner"&gt; <div class="accordion-inner">
Anim pariatur cliche... ...
&lt;/div&gt; </div>
&lt;/div&gt; </div>
&lt;/div&gt; </div>
&lt;div class="accordion-group"&gt; <div class="accordion-group">
&lt;div class="accordion-heading"&gt; <div class="accordion-heading">
&lt;a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo"&gt; <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
Collapsible Group Item #2 Collapsible Group Item #2
&lt;/a&gt; </a>
&lt;/div&gt; </div>
&lt;div id="collapseTwo" class="accordion-body collapse"&gt; <div id="collapseTwo" class="accordion-body collapse">
&lt;div class="accordion-inner"&gt; <div class="accordion-inner">
Anim pariatur cliche... ...
&lt;/div&gt; </div>
&lt;/div&gt; </div>
&lt;/div&gt; </div>
&lt;/div&gt; <div class="accordion-group">
... <div class="accordion-heading">
</pre> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseThree">
<p>You can also use the plugin without the accordion markup. Make a button toggle the expanding and collapsing of another element.</p> Collapsible Group Item #3
<pre class="prettyprint linenums"> </a>
&lt;button type="button" class="btn btn-danger" data-toggle="collapse" data-target="#demo"&gt; </div>
simple collapsible <div id="collapseThree" class="accordion-body collapse">
&lt;/button&gt; <div class="accordion-inner">
...
</div>
</div>
</div>
</div>
{% endhighlight %}
&lt;div id="demo" class="collapse in"&gt;&lt;/div&gt; <p>You can also use the plugin without the accordion markup. Make a button toggle the expanding and collapsing of another element.</p>
</pre> {% highlight html linenos %}
<button type="button" class="btn btn-danger" data-toggle="collapse" data-target="#demo">
simple collapsible
</button>
<div id="demo" class="collapse in">...</div>
{% endhighlight %}
<hr class="bs-docs-separator"> <hr class="bs-docs-separator">
@ -1303,7 +1373,9 @@ $('#my-alert').bind('closed', function () {
<h3>Via JavaScript</h3> <h3>Via JavaScript</h3>
<p>Enable manually with:</p> <p>Enable manually with:</p>
<pre class="prettyprint linenums">$(".collapse").collapse()</pre> {% highlight js linenos %}
$(".collapse").collapse()
{% endhighlight %}
<h3>Options</h3> <h3>Options</h3>
<p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-parent=""</code>.</p> <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-parent=""</code>.</p>
@ -1334,17 +1406,21 @@ $('#my-alert').bind('closed', function () {
<h3>Methods</h3> <h3>Methods</h3>
<h4>.collapse(options)</h4> <h4>.collapse(options)</h4>
<p>Activates your content as a collapsible element. Accepts an optional options <code>object</code>. <p>Activates your content as a collapsible element. Accepts an optional options <code>object</code>.
<pre class="prettyprint linenums"> {% highlight js linenos %}
$('#myCollapsible').collapse({ $('#myCollapsible').collapse({
toggle: false toggle: false
}) })
</pre> {% endhighlight %}
<h4>.collapse('toggle')</h4> <h4>.collapse('toggle')</h4>
<p>Toggles a collapsible element to shown or hidden.</p> <p>Toggles a collapsible element to shown or hidden.</p>
<h4>.collapse('show')</h4> <h4>.collapse('show')</h4>
<p>Shows a collapsible element.</p> <p>Shows a collapsible element.</p>
<h4>.collapse('hide')</h4> <h4>.collapse('hide')</h4>
<p>Hides a collapsible element.</p> <p>Hides a collapsible element.</p>
@ -1378,10 +1454,11 @@ $('#myCollapsible').collapse({
</tr> </tr>
</tbody> </tbody>
</table> </table>
<pre class="prettyprint linenums"> {% highlight js linenos %}
$('#myCollapsible').on('hidden', function () { $('#myCollapsible').on('hidden', function () {
// do something… // do something…
})</pre> })
{% endhighlight %}
</section> </section>
@ -1433,24 +1510,35 @@ $('#myCollapsible').on('hidden', function () {
</a> </a>
</div> </div>
</div><!-- /example --> </div><!-- /example -->
<pre class="prettyprint linenums"> {% highlight html linenos %}
&lt;div id="myCarousel" class="carousel slide"&gt; <div id="myCarousel" class="carousel slide">
&lt;ol class="carousel-indicators"&gt <!-- Indicators -->
&lt;li data-target="#myCarousel" data-slide-to="0" class="active"&gt&lt;/li&gt <ol class="carousel-indicators">
&lt;li data-target="#myCarousel" data-slide-to="1"&gt&lt;/li&gt <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
&lt;li data-target="#myCarousel" data-slide-to="2"&gt&lt;/li&gt <li data-target="#myCarousel" data-slide-to="1"></li>
&lt;/ol&gt <li data-target="#myCarousel" data-slide-to="2"></li>
&lt;!-- Carousel items --&gt; </ol>
&lt;div class="carousel-inner"&gt;
&lt;div class="active item"&gt;&lt;/div&gt; <!-- Wrapper for slides -->
&lt;div class="item"&gt;&lt;/div&gt; <div class="carousel-inner">
&lt;div class="item"&gt;&lt;/div&gt; <div class="item active">
&lt;/div&gt; <img src="..." alt="">
&lt;!-- Carousel nav --&gt; <div class="carousel-caption">
&lt;a class="carousel-control left" href="#myCarousel" data-slide="prev"&gt;&amp;lsaquo;&lt;/a&gt; ...
&lt;a class="carousel-control right" href="#myCarousel" data-slide="next"&gt;&amp;rsaquo;&lt;/a&gt; </div>
&lt;/div&gt; </div>
</pre> ...
</div>
<!-- Controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="control">&lsaquo;</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="control">&rsaquo;</span>
</a>
</div>
{% endhighlight %}
<div class="alert alert-warning"> <div class="alert alert-warning">
<strong>Heads up!</strong> <strong>Heads up!</strong>
@ -1468,7 +1556,9 @@ $('#myCollapsible').on('hidden', function () {
<h3>Via JavaScript</h3> <h3>Via JavaScript</h3>
<p>Call carousel manually with:</p> <p>Call carousel manually with:</p>
<pre class="prettyprint linenums">$('.carousel').carousel()</pre> {% highlight js linenos %}
$('.carousel').carousel()
{% endhighlight %}
<h3>Options</h3> <h3>Options</h3>
<p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-interval=""</code>.</p> <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-interval=""</code>.</p>
@ -1498,21 +1588,27 @@ $('#myCollapsible').on('hidden', function () {
</table> </table>
<h3>Methods</h3> <h3>Methods</h3>
<h4>.carousel(options)</h4> <h4>.carousel(options)</h4>
<p>Initializes the carousel with an optional options <code>object</code> and starts cycling through items.</p> <p>Initializes the carousel with an optional options <code>object</code> and starts cycling through items.</p>
<pre class="prettyprint linenums"> {% highlight html linenos %}
$('.carousel').carousel({ $('.carousel').carousel({
interval: 2000 interval: 2000
}) })
</pre> {% endhighlight %}
<h4>.carousel('cycle')</h4> <h4>.carousel('cycle')</h4>
<p>Cycles through the carousel items from left to right.</p> <p>Cycles through the carousel items from left to right.</p>
<h4>.carousel('pause')</h4> <h4>.carousel('pause')</h4>
<p>Stops the carousel from cycling through items.</p> <p>Stops the carousel from cycling through items.</p>
<h4>.carousel(number)</h4> <h4>.carousel(number)</h4>
<p>Cycles the carousel to a particular frame (0 based, similar to an array).</p> <p>Cycles the carousel to a particular frame (0 based, similar to an array).</p>
<h4>.carousel('prev')</h4> <h4>.carousel('prev')</h4>
<p>Cycles to the previous item.</p> <p>Cycles to the previous item.</p>
<h4>.carousel('next')</h4> <h4>.carousel('next')</h4>
<p>Cycles to the next item.</p> <p>Cycles to the next item.</p>
@ -1553,7 +1649,10 @@ $('.carousel').carousel({
<div class="bs-docs-example" style="background-color: #f5f5f5;"> <div class="bs-docs-example" style="background-color: #f5f5f5;">
<input type="text" class="span3" style="margin: 0 auto;" data-provide="typeahead" data-items="4" data-source='["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Dakota","North Carolina","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"]'> <input type="text" class="span3" style="margin: 0 auto;" data-provide="typeahead" data-items="4" data-source='["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Dakota","North Carolina","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"]'>
</div><!-- /example --> </div><!-- /example -->
<pre class="prettyprint linenums">&lt;input type="text" data-provide="typeahead"&gt;</pre> {% highlight html linenos %}
<input type="text" data-provide="typeahead">
{% endhighlight %}
<p>You'll want to set <code>autocomplete="off"</code> to prevent default browser menus from appearing over the Bootstrap typeahead dropdown.</p> <p>You'll want to set <code>autocomplete="off"</code> to prevent default browser menus from appearing over the Bootstrap typeahead dropdown.</p>
<hr class="bs-docs-separator"> <hr class="bs-docs-separator">
@ -1566,7 +1665,9 @@ $('.carousel').carousel({
<h3>Via JavaScript</h3> <h3>Via JavaScript</h3>
<p>Call the typeahead manually with:</p> <p>Call the typeahead manually with:</p>
<pre class="prettyprint linenums">$('.typeahead').typeahead()</pre> {% highlight js linenos %}
$('.typeahead').typeahead()
{% endhighlight %}
<h3>Options</h3> <h3>Options</h3>
<p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-source=""</code>.</p> <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-source=""</code>.</p>
@ -1649,7 +1750,9 @@ $('.carousel').carousel({
<h3>Via data attributes</h3> <h3>Via data attributes</h3>
<p>To easily add affix behavior to any element, just add <code>data-spy="affix"</code> to the element you want to spy on. Then use offsets to define when to toggle the pinning of an element on and off.</p> <p>To easily add affix behavior to any element, just add <code>data-spy="affix"</code> to the element you want to spy on. Then use offsets to define when to toggle the pinning of an element on and off.</p>
<pre class="prettyprint linenums">&lt;div data-spy="affix" data-offset-top="200"&gt;...&lt;/div&gt;</pre> {% highlight html linenos %}
<div data-spy="affix" data-offset-top="200">...</div>
{% endhighlight %}
<div class="alert alert-info"> <div class="alert alert-info">
<strong>Heads up!</strong> <strong>Heads up!</strong>
@ -1658,16 +1761,19 @@ $('.carousel').carousel({
<h3>Via JavaScript</h3> <h3>Via JavaScript</h3>
<p>Call the affix plugin via JavaScript:</p> <p>Call the affix plugin via JavaScript:</p>
<pre class="prettyprint linenums">$('#navbar').affix()</pre> {% highlight js linenos %}
$('#navbar').affix()
{% endhighlight %}
<h3>Methods</h3> <h3>Methods</h3>
<h4>.affix('refresh')</h4> <h4>.affix('refresh')</h4>
<p>When using affix in conjunction with adding or removing of elements from the DOM, you'll want to call the refresh method:</p> <p>When using affix in conjunction with adding or removing of elements from the DOM, you'll want to call the refresh method:</p>
<pre class="prettyprint linenums"> {% highlight js linenos %}
$('[data-spy="affix"]').each(function () { $('[data-spy="affix"]').each(function () {
$(this).affix('refresh') $(this).affix('refresh')
}); });
</pre> {% endhighlight %}
<h3>Options</h3> <h3>Options</h3>
<p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-offset-top="200"</code>.</p> <p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-offset-top="200"</code>.</p>