diff options
author | 2017-05-03 21:31:58 +0000 | |
---|---|---|
committer | 2017-05-03 21:31:58 +0000 | |
commit | a330af579866dacbe595e2e4ad1dd29cd3c96945 (patch) | |
tree | b9455591600034dfd4f33a9c1f733336280f2208 /POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/docs/_includes/js/overview.html | |
parent | 5444e748b8651d8346dcb78c5ab8b0637dea197b (diff) | |
parent | e0addf5b588a1244f9679becd90999dfcb4c3a94 (diff) |
Merge "Policy 1707 commit to LF"
Diffstat (limited to 'POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/docs/_includes/js/overview.html')
-rw-r--r-- | POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/docs/_includes/js/overview.html | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/docs/_includes/js/overview.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/docs/_includes/js/overview.html new file mode 100644 index 000000000..19adc16fd --- /dev/null +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/docs/_includes/js/overview.html @@ -0,0 +1,86 @@ +<div class="bs-docs-section"> + <h1 id="js-overview" class="page-header">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="{{ site.repo }}/blob/v{{ site.current_version }}/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> +{% highlight js %} +$(document).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> +{% highlight js %} +$(document).off('.alert.data-api') +{% endhighlight %} + + <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> +{% highlight js %} +$('.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> +{% highlight js %} +$('#myModal').modal() // initialized with defaults +$('#myModal').modal({ keyboard: false }) // initialized with no keyboard +$('#myModal').modal('show') // initializes and invokes show immediately +{% endhighlight %} + + <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> +{% highlight js %} +$.fn.modal.Constructor.DEFAULTS.keyboard = false // changes default for the modal plugin's `keyboard` option to false +{% endhighlight %} + + <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> +{% highlight js %} +var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value +$.fn.bootstrapBtn = bootstrapButton // give $().bootstrapBtn the Bootstrap functionality +{% endhighlight %} + + <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> +{% highlight js %} +$('#myModal').on('show.bs.modal', function (e) { + if (!data) return e.preventDefault() // stops modal from being shown +}) +{% endhighlight %} + + <h2 id="js-version-nums">Version numbers</h2> + <p>The version of each of Bootstrap's jQuery plugins can be accessed via the <code>VERSION</code> property of the plugin's constructor. For example, for the tooltip plugin:</p> +{% highlight js %} +$.fn.tooltip.Constructor.VERSION // => "{{ site.current_version }}" +{% endhighlight %} + + <h2 id="js-disabled">No special fallbacks when JavaScript is disabled</h2> + <p>Bootstrap's plugins don't fall back particularly gracefully when JavaScript is disabled. If you care about the user experience in this case, use <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript"><code><noscript></code></a> to explain the situation (and how to re-enable JavaScript) to your users, and/or add your own custom fallbacks.</p> + + <div class="bs-callout bs-callout-warning" id="callout-third-party-libs"> + <h4>Third-party libraries</h4> + <p><strong>Bootstrap does not officially support third-party JavaScript libraries</strong> like Prototype or jQuery UI. Despite <code>.noConflict</code> and namespaced events, there may be compatibility problems that you need to fix on your own.</p> + </div> +</div> |