diff options
| author | Jacob Thornton <[email protected]> | 2011-10-04 21:24:59 -0700 |
|---|---|---|
| committer | Jacob Thornton <[email protected]> | 2011-10-04 21:24:59 -0700 |
| commit | d7e3bf722d784b167b665e8bacb749f18ae0d0f4 (patch) | |
| tree | e680e0bc9306d7625d231ed2f7ef8f74ed5f4308 | |
| parent | 7e01ff8a15f9024fdebc3859283ccc1f4c63cec7 (diff) | |
| download | bootstrap-d7e3bf722d784b167b665e8bacb749f18ae0d0f4.tar.xz bootstrap-d7e3bf722d784b167b665e8bacb749f18ae0d0f4.zip | |
add selector option to alerts, update modal settings strategy
| -rw-r--r-- | bootstrap.css | 4 | ||||
| -rw-r--r-- | docs/javascript.html | 21 | ||||
| -rw-r--r-- | js/bootstrap-alerts.js | 15 | ||||
| -rw-r--r-- | js/bootstrap-modal.js | 4 |
4 files changed, 34 insertions, 10 deletions
diff --git a/bootstrap.css b/bootstrap.css index f1a5cc7d3..c663f08ee 100644 --- a/bootstrap.css +++ b/bootstrap.css @@ -6,7 +6,7 @@ * http://www.apache.org/licenses/LICENSE-2.0 * * Designed and built with all the love in the world @twitter by @mdo and @fat. - * Date: Thu Sep 22 12:52:42 PDT 2011 + * Date: Tue Oct 4 15:28:53 PDT 2011 */ /* Reset.less * Props to Eric Meyer (meyerweb.com) for his CSS reset file. We're using an adapted version here that cuts out some of the reset HTML elements we will never need here (i.e., dfn, samp, etc). @@ -173,7 +173,7 @@ textarea { /* Variables.less * Variables to customize the look and feel of Bootstrap * ----------------------------------------------------- */ -/* Variables.less +/* Mixins.less * Snippets of reusable CSS to develop faster and keep code readable * ----------------------------------------------------------------- */ /* diff --git a/docs/javascript.html b/docs/javascript.html index 2a81b3307..2891c4460 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -195,7 +195,6 @@ $('#my-modal').bind('hidden', function () { </div> <button data-controls-modal="modal-from-dom" data-backdrop="true" data-keyboard="true" class="btn danger">Launch Modal</button> - </div> </div> </section> @@ -659,6 +658,26 @@ $('#.tabs').bind('change', function (e) { <pre class="prettyprint linenums">$(".alert-message").alert()</pre> <h3>Markup</h3> <p>Just add a <code>data-alert</code> attribute to your alert messages to automatically give them close functionality.</p> + <h3>Options</h3> + <table class="zebra-striped"> + <thead> + <tr> + <th style="width: 100px;">Name</th> + <th style="width: 100px;">type</th> + <th style="width: 50px;">default</th> + <th>description</th> + </tr> + </thead> + <tbody> + <tr> + <td>selector</td> + <td>string</td> + <td>'.close'</td> + <td>What selector to target for closing an alert.</td> + </tr> + </tbody> + </table> + <h3>Methods</h3> <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> diff --git a/js/bootstrap-alerts.js b/js/bootstrap-alerts.js index 266029cc4..a8d15e24e 100644 --- a/js/bootstrap-alerts.js +++ b/js/bootstrap-alerts.js @@ -51,9 +51,10 @@ /* ALERT CLASS DEFINITION * ====================== */ - var Alert = function ( content, selector ) { + var Alert = function ( content, options ) { + this.settings = $.extend({}, $.fn.alert.defaults, options) this.$element = $(content) - .delegate(selector || '.close', 'click', this.close) + .delegate(this.settings.selector, 'click', this.close) } Alert.prototype = { @@ -92,13 +93,19 @@ return $this.data('alert')[options]() } - $(this).data('alert', new Alert( this )) + $(this).data('alert', new Alert( this, options )) }) } + $.fn.alert.defaults = { + selector: '.close' + } + $(document).ready(function () { - new Alert($('body'), '.alert-message[data-alert] .close') + new Alert($('body'), { + selector: '.alert-message[data-alert] .close' + }) }) }( window.jQuery || window.ender );
\ No newline at end of file diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js index 76c495259..2cc910989 100644 --- a/js/bootstrap-modal.js +++ b/js/bootstrap-modal.js @@ -53,12 +53,10 @@ * ============================= */ var Modal = function ( content, options ) { - this.settings = $.extend({}, $.fn.modal.defaults) + this.settings = $.extend({}, $.fn.modal.defaults, options) this.$element = $(content) .delegate('.close', 'click.modal', $.proxy(this.hide, this)) - $.extend( this.settings, options ) - if ( this.settings.show ) { this.show() } |
