aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2011-10-04 21:24:59 -0700
committerJacob Thornton <[email protected]>2011-10-04 21:24:59 -0700
commitd7e3bf722d784b167b665e8bacb749f18ae0d0f4 (patch)
treee680e0bc9306d7625d231ed2f7ef8f74ed5f4308 /js
parent7e01ff8a15f9024fdebc3859283ccc1f4c63cec7 (diff)
downloadbootstrap-d7e3bf722d784b167b665e8bacb749f18ae0d0f4.tar.xz
bootstrap-d7e3bf722d784b167b665e8bacb749f18ae0d0f4.zip
add selector option to alerts, update modal settings strategy
Diffstat (limited to 'js')
-rw-r--r--js/bootstrap-alerts.js15
-rw-r--r--js/bootstrap-modal.js4
2 files changed, 12 insertions, 7 deletions
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()
}