diff options
| author | Mark Otto <[email protected]> | 2016-09-05 21:09:15 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2016-09-05 21:09:15 -0700 |
| commit | cfaf7beda22f79329fa44d39d499c0e23649d759 (patch) | |
| tree | eabf848e53506c6f3047abec5bd93e802e7739d5 /javascript | |
| parent | e3532090d2090465b065e9f50048afd4aeb6814f (diff) | |
| download | bootstrap-cfaf7beda22f79329fa44d39d499c0e23649d759.tar.xz bootstrap-cfaf7beda22f79329fa44d39d499c0e23649d759.zip | |
alpha url
Diffstat (limited to 'javascript')
| -rw-r--r-- | javascript/index.html | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/javascript/index.html b/javascript/index.html index 806b70faf..83406b977 100644 --- a/javascript/index.html +++ b/javascript/index.html @@ -1,4 +1,4 @@ -<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <meta content="IE=edge" http-equiv=X-UA-Compatible> <meta content="width=device-width,initial-scale=1" name=viewport> <meta content="Bootstrap, a sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development." name=description> <meta content="Mark Otto, Jacob Thornton, and Bootstrap contributors" name=author> <title> JavaScript · Bootstrap </title> <link href=../dist/css/bootstrap.min.css rel=stylesheet> <link href="data:text/css;charset=utf-8," rel=stylesheet data-href=../dist/css/bootstrap-theme.min.css id=bs-theme-stylesheet> <link href=../assets/css/docs.min.css rel=stylesheet> <!--[if lt IE 9]><script src=../assets/js/ie8-responsive-file-warning.js></script><![endif]--> <script src=../assets/js/ie-emulation-modes-warning.js></script> <!--[if lt IE 9]> <script src=https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js></script> <script src=https://oss.maxcdn.com/respond/1.4.2/respond.min.js></script> <![endif]--> <link href=/apple-touch-icon.png rel=apple-touch-icon> <link href=/favicon.ico rel=icon> <script>!function(e,t,a,n,c,o,s){e.GoogleAnalyticsObject=c,e[c]=e[c]||function(){(e[c].q=e[c].q||[]).push(arguments)},e[c].l=1*new Date,o=t.createElement(a),s=t.getElementsByTagName(a)[0],o.async=1,o.src=n,s.parentNode.insertBefore(o,s)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-146052-10","getbootstrap.com"),ga("send","pageview")</script> </head> <body> <a href=#content class="sr-only sr-only-focusable" id=skippy><div class=container><span class=skiplink-text>Skip to main content</span></div></a> <a href=http://blog.getbootstrap.com/2015/12/08/bootstrap-4-alpha-2/ class=v4-tease>Aww yeah, Bootstrap 4 is coming!</a> <header class="bs-docs-nav navbar navbar-static-top" id=top> <div class=container> <div class=navbar-header> <button aria-controls=bs-navbar aria-expanded=false class="collapsed navbar-toggle" data-target=#bs-navbar data-toggle=collapse type=button> <span class=sr-only>Toggle navigation</span> <span class=icon-bar></span> <span class=icon-bar></span> <span class=icon-bar></span> </button> <a href=../ class=navbar-brand>Bootstrap</a> </div> <nav class="collapse navbar-collapse" id=bs-navbar> <ul class="nav navbar-nav"> <li> <a href=../getting-started/ >Getting started</a> </li> <li> <a href=../css/ >CSS</a> </li> <li> <a href=../components/ >Components</a> </li> <li class=active> <a href=../javascript/ >JavaScript</a> </li> <li> <a href=../customize/ >Customize</a> </li> </ul> <ul class="nav navbar-nav navbar-right"> <li><a href=http://themes.getbootstrap.com onclick='ga("send","event","Navbar","Community links","Themes")'>Themes</a></li> <li><a href=http://expo.getbootstrap.com onclick='ga("send","event","Navbar","Community links","Expo")'>Expo</a></li> <li><a href=http://blog.getbootstrap.com onclick='ga("send","event","Navbar","Community links","Blog")'>Blog</a></li> </ul> </nav> </div> </header> <div class=bs-docs-header id=content tabindex=-1> <div class=container> <h1>JavaScript</h1> <p>Bring Bootstrap's components to life with over a dozen custom jQuery plugins. Easily include them all, or one by one.</p> <div id=carbonads-container><div class=carbonad><div id=azcarbon></div><script>var z=document.createElement("script");z.async=!0,z.src="http://engine.carbonads.com/z/32341/azcarbon_2_1_0_HORIZ";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(z,s)</script></div></div> </div> </div> <div class="container bs-docs-container"> <div class=row> <div class=col-md-9 role=main> <div class=bs-docs-section> <h1 class=page-header id=js-overview>Overview</h1> <h2 id=js-individual-compiled>Individual or compiled</h2> <p>Plugins can be included individually (using Bootstrap's individual <code>*.js</code> files), or all at once (using <code>bootstrap.js</code> or the minified <code>bootstrap.min.js</code>).</p> <div class="bs-callout bs-callout-danger" id=callout-overview-not-both> <h4>Using the compiled JavaScript</h4> <p>Both <code>bootstrap.js</code> and <code>bootstrap.min.js</code> contain all plugins in a single file. Include only one.</p> </div> <div class="bs-callout bs-callout-danger" id=callout-overview-dependencies> <h4>Plugin dependencies</h4> <p>Some plugins and CSS components depend on other plugins. If you include plugins individually, make sure to check for these dependencies in the docs. Also note that all plugins depend on jQuery (this means jQuery must be included <strong>before</strong> the plugin files). <a href=https://github.com/twbs/bootstrap/blob/v3.3.7/bower.json>Consult our <code>bower.json</code></a> to see which versions of jQuery are supported.</p> </div> <h2 id=js-data-attrs>Data attributes</h2> <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 document namespaced with <code>data-api</code>. This looks like this:</p> <figure class=highlight><pre><code class=language-js data-lang=js><span class=nx>$</span><span class=p>(</span><span class=nb>document</span><span class=p>).</span><span class=nx>off</span><span class=p>(</span><span class=s1>'.data-api'</span><span class=p>)</span></code></pre></figure> <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> <figure class=highlight><pre><code class=language-js data-lang=js><span class=nx>$</span><span class=p>(</span><span class=nb>document</span><span class=p>).</span><span class=nx>off</span><span class=p>(</span><span class=s1>'.alert.data-api'</span><span class=p>)</span></code></pre></figure> <div class="bs-callout bs-callout-danger" id=callout-overview-single-data> <h4>Only one plugin per element via data attributes</h4> <p>Don't use data attributes from multiple plugins on the same element. For example, a button cannot both have a tooltip and toggle a modal. To accomplish this, use a wrapping element.</p> </div> <h2 id=js-programmatic-api>Programmatic API</h2> <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> <figure class=highlight><pre><code class=language-js data-lang=js><span class=nx>$</span><span class=p>(</span><span class=s1>'.btn.danger'</span><span class=p>).</span><span class=nx>button</span><span class=p>(</span><span class=s1>'toggle'</span><span class=p>).</span><span class=nx>addClass</span><span class=p>(</span><span class=s1>'fat'</span><span class=p>)</span></code></pre></figure> <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> <figure class=highlight><pre><code class=language-js data-lang=js><span class=nx>$</span><span class=p>(</span><span class=s1>'#myModal'</span><span class=p>).</span><span class=nx>modal</span><span class=p>()</span> <span class=c1>// initialized with defaults</span> +<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <meta content="IE=edge" http-equiv=X-UA-Compatible> <meta content="width=device-width,initial-scale=1" name=viewport> <meta content="Bootstrap, a sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development." name=description> <meta content="Mark Otto, Jacob Thornton, and Bootstrap contributors" name=author> <title> JavaScript · Bootstrap </title> <link href=../dist/css/bootstrap.min.css rel=stylesheet> <link href="data:text/css;charset=utf-8," rel=stylesheet data-href=../dist/css/bootstrap-theme.min.css id=bs-theme-stylesheet> <link href=../assets/css/docs.min.css rel=stylesheet> <!--[if lt IE 9]><script src=../assets/js/ie8-responsive-file-warning.js></script><![endif]--> <script src=../assets/js/ie-emulation-modes-warning.js></script> <!--[if lt IE 9]> <script src=https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js></script> <script src=https://oss.maxcdn.com/respond/1.4.2/respond.min.js></script> <![endif]--> <link href=/apple-touch-icon.png rel=apple-touch-icon> <link href=/favicon.ico rel=icon> <script>!function(e,t,a,n,c,o,s){e.GoogleAnalyticsObject=c,e[c]=e[c]||function(){(e[c].q=e[c].q||[]).push(arguments)},e[c].l=1*new Date,o=t.createElement(a),s=t.getElementsByTagName(a)[0],o.async=1,o.src=n,s.parentNode.insertBefore(o,s)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-146052-10","getbootstrap.com"),ga("send","pageview")</script> </head> <body> <a href=#content class="sr-only sr-only-focusable" id=skippy><div class=container><span class=skiplink-text>Skip to main content</span></div></a> <a href=http://blog.getbootstrap.com/2016/09/05/bootstrap-4-alpha-4/ class=v4-tease>Aww yeah, Bootstrap 4 is coming!</a> <header class="bs-docs-nav navbar navbar-static-top" id=top> <div class=container> <div class=navbar-header> <button aria-controls=bs-navbar aria-expanded=false class="collapsed navbar-toggle" data-target=#bs-navbar data-toggle=collapse type=button> <span class=sr-only>Toggle navigation</span> <span class=icon-bar></span> <span class=icon-bar></span> <span class=icon-bar></span> </button> <a href=../ class=navbar-brand>Bootstrap</a> </div> <nav class="collapse navbar-collapse" id=bs-navbar> <ul class="nav navbar-nav"> <li> <a href=../getting-started/ >Getting started</a> </li> <li> <a href=../css/ >CSS</a> </li> <li> <a href=../components/ >Components</a> </li> <li class=active> <a href=../javascript/ >JavaScript</a> </li> <li> <a href=../customize/ >Customize</a> </li> </ul> <ul class="nav navbar-nav navbar-right"> <li><a href=http://themes.getbootstrap.com onclick='ga("send","event","Navbar","Community links","Themes")'>Themes</a></li> <li><a href=http://expo.getbootstrap.com onclick='ga("send","event","Navbar","Community links","Expo")'>Expo</a></li> <li><a href=http://blog.getbootstrap.com onclick='ga("send","event","Navbar","Community links","Blog")'>Blog</a></li> </ul> </nav> </div> </header> <div class=bs-docs-header id=content tabindex=-1> <div class=container> <h1>JavaScript</h1> <p>Bring Bootstrap's components to life with over a dozen custom jQuery plugins. Easily include them all, or one by one.</p> <div id=carbonads-container><div class=carbonad><div id=azcarbon></div><script>var z=document.createElement("script");z.async=!0,z.src="http://engine.carbonads.com/z/32341/azcarbon_2_1_0_HORIZ";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(z,s)</script></div></div> </div> </div> <div class="container bs-docs-container"> <div class=row> <div class=col-md-9 role=main> <div class=bs-docs-section> <h1 class=page-header id=js-overview>Overview</h1> <h2 id=js-individual-compiled>Individual or compiled</h2> <p>Plugins can be included individually (using Bootstrap's individual <code>*.js</code> files), or all at once (using <code>bootstrap.js</code> or the minified <code>bootstrap.min.js</code>).</p> <div class="bs-callout bs-callout-danger" id=callout-overview-not-both> <h4>Using the compiled JavaScript</h4> <p>Both <code>bootstrap.js</code> and <code>bootstrap.min.js</code> contain all plugins in a single file. Include only one.</p> </div> <div class="bs-callout bs-callout-danger" id=callout-overview-dependencies> <h4>Plugin dependencies</h4> <p>Some plugins and CSS components depend on other plugins. If you include plugins individually, make sure to check for these dependencies in the docs. Also note that all plugins depend on jQuery (this means jQuery must be included <strong>before</strong> the plugin files). <a href=https://github.com/twbs/bootstrap/blob/v3.3.7/bower.json>Consult our <code>bower.json</code></a> to see which versions of jQuery are supported.</p> </div> <h2 id=js-data-attrs>Data attributes</h2> <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 document namespaced with <code>data-api</code>. This looks like this:</p> <figure class=highlight><pre><code class=language-js data-lang=js><span class=nx>$</span><span class=p>(</span><span class=nb>document</span><span class=p>).</span><span class=nx>off</span><span class=p>(</span><span class=s1>'.data-api'</span><span class=p>)</span></code></pre></figure> <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> <figure class=highlight><pre><code class=language-js data-lang=js><span class=nx>$</span><span class=p>(</span><span class=nb>document</span><span class=p>).</span><span class=nx>off</span><span class=p>(</span><span class=s1>'.alert.data-api'</span><span class=p>)</span></code></pre></figure> <div class="bs-callout bs-callout-danger" id=callout-overview-single-data> <h4>Only one plugin per element via data attributes</h4> <p>Don't use data attributes from multiple plugins on the same element. For example, a button cannot both have a tooltip and toggle a modal. To accomplish this, use a wrapping element.</p> </div> <h2 id=js-programmatic-api>Programmatic API</h2> <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> <figure class=highlight><pre><code class=language-js data-lang=js><span class=nx>$</span><span class=p>(</span><span class=s1>'.btn.danger'</span><span class=p>).</span><span class=nx>button</span><span class=p>(</span><span class=s1>'toggle'</span><span class=p>).</span><span class=nx>addClass</span><span class=p>(</span><span class=s1>'fat'</span><span class=p>)</span></code></pre></figure> <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> <figure class=highlight><pre><code class=language-js data-lang=js><span class=nx>$</span><span class=p>(</span><span class=s1>'#myModal'</span><span class=p>).</span><span class=nx>modal</span><span class=p>()</span> <span class=c1>// initialized with defaults</span> <span class=nx>$</span><span class=p>(</span><span class=s1>'#myModal'</span><span class=p>).</span><span class=nx>modal</span><span class=p>({</span> <span class=na>keyboard</span><span class=p>:</span> <span class=kc>false</span> <span class=p>})</span> <span class=c1>// initialized with no keyboard</span> <span class=nx>$</span><span class=p>(</span><span class=s1>'#myModal'</span><span class=p>).</span><span class=nx>modal</span><span class=p>(</span><span class=s1>'show'</span><span class=p>)</span> <span class=c1>// initializes and invokes show immediately</span></code></pre></figure> <p>Each plugin also exposes its raw constructor on a <code>Constructor</code> 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> <h4>Default settings</h4> <p>You can change the default settings for a plugin by modifying the plugin's <code>Constructor.DEFAULTS</code> object:</p> <figure class=highlight><pre><code class=language-js data-lang=js><span class=nx>$</span><span class=p>.</span><span class=nx>fn</span><span class=p>.</span><span class=nx>modal</span><span class=p>.</span><span class=nx>Constructor</span><span class=p>.</span><span class=nx>DEFAULTS</span><span class=p>.</span><span class=nx>keyboard</span> <span class=o>=</span> <span class=kc>false</span> <span class=c1>// changes default for the modal plugin's `keyboard` option to false</span></code></pre></figure> <h2 id=js-noconflict>No conflict</h2> <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> <figure class=highlight><pre><code class=language-js data-lang=js><span class=kd>var</span> <span class=nx>bootstrapButton</span> <span class=o>=</span> <span class=nx>$</span><span class=p>.</span><span class=nx>fn</span><span class=p>.</span><span class=nx>button</span><span class=p>.</span><span class=nx>noConflict</span><span class=p>()</span> <span class=c1>// return $.fn.button to previously assigned value</span> <span class=nx>$</span><span class=p>.</span><span class=nx>fn</span><span class=p>.</span><span class=nx>bootstrapBtn</span> <span class=o>=</span> <span class=nx>bootstrapButton</span> <span class=c1>// give $().bootstrapBtn the Bootstrap functionality</span></code></pre></figure> <h2 id=js-events>Events</h2> <p>Bootstrap provides custom events for most plugins' 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 triggered on the completion of an action.</p> <p>As of 3.0.0, all Bootstrap events are namespaced.</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> <figure class=highlight><pre><code class=language-js data-lang=js><span class=nx>$</span><span class=p>(</span><span class=s1>'#myModal'</span><span class=p>).</span><span class=nx>on</span><span class=p>(</span><span class=s1>'show.bs.modal'</span><span class=p>,</span> <span class=kd>function</span> <span class=p>(</span><span class=nx>e</span><span class=p>)</span> <span class=p>{</span> |
