@@ -473,16 +479,18 @@ Sunt qui biodiesel mollit officia, fanny pack put a bird on it thundercats seita
Methods
- $().twipsy
+ $().twipsy(options)
Attaches a twipsy handler to an element collection.
- Events
- You can manually control twipsies by firing events on the controlling element.
- twipsy:show
+ .twipsy('show')
Reveals an elements twipsy.
- $('#element').trigger('twipsy:show')
- twipsy:hide
+ $('#element').twipsy('show')
+ .twipsy('hide')
Hides an elements twipsy.
- $('#element').trigger('twipsy:hide')
+ $('#element').twipsy('hide')
+ .twipsy(true)
+ Returns an elements twipsy class instance.
+ $('#element').twipsy(true)
+ Notice Alternatively, this can be retrieved with $().data('twipsy')
.
Demo
Tight pants next level keffiyeh you probably haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel have a terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A really ironic artisan whatever keytar, scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.
@@ -515,32 +523,95 @@ Sunt qui biodiesel mollit officia, fanny pack put a bird on it thundercats seita
Using boostrap-popover.js
$('#example').popover(options)
Options
-
- - animate (
boolean
) - apply a css fade transition to the popover.
- - delayIn (
number
) - delay before showing tooltip (ms).
- - delayOut (
number
) - delay before hiding tooltip (ms).
- - fallback (
string
) - fallback text to use when no tooltip text.
- - placement (
string
) - position of tooltip - above | below | left | right.
- - html (
boolean
) - is tooltip content HTML?
- - live (
boolean
) - use live event support?
- - offset (
number
) - pixel offset of tooltip from element.
- - title (
string|function
) - text for title in popover. Alternatively you can specify a data-title
attribute.
- - content (
string|function
) - text for content in popover. Also you can specify a data-content
attibute.
- - trigger (
string
) - how tooltip is triggered - hover | focus | manual.
-
+
+
+
+ Name |
+ type |
+ default |
+ description |
+
+
+
+
+ animate |
+ boolean |
+ true |
+ apply a css fade transition to the tooltip |
+
+
+ delayIn |
+ number |
+ 0 |
+ delay before showing tooltip (ms) |
+
+
+ delayOut |
+ number |
+ 0 |
+ delay before hiding tooltip (ms) |
+
+
+ fallback |
+ string |
+ '' |
+ text to use when no tooltip title is present |
+
+
+ placement |
+ string |
+ 'right' |
+ how to position the tooltip - above | below | left | right |
+
+
+ html |
+ boolean |
+ false |
+ allows html content within tooltip |
+
+
+ live |
+ boolean |
+ false |
+ use event delegation instead of individual event handlers |
+
+
+ offset |
+ number |
+ 0 |
+ pixel offset of tooltip from target element |
+
+
+ title |
+ string | function |
+ 'title' |
+ attribute or method for retrieving title text |
+
+
+ content |
+ string | function |
+ 'data-content' |
+ attribute or method for retrieving content text |
+
+
+ trigger |
+ string |
+ 'hover' |
+ how tooltip is triggered - hover | focus | manual |
+
+
+
Methods
-
$().popover
+
$().popover(options)
Initializes popovers for an element collection.
-
Events
-
You can manually control popovers by firing events on the controlling element.
-
popover:show
+
.popover('show')
Reveals an elements popover.
-
$('#element').trigger('popover:show')
-
popover:hide
+
$('#element').popover('show')
+
.popover('hide')
Hides an elements popover.
-
$('#element').trigger('popover:hide')
+
$('#element').popover('hide')
Demo
-
hover for popover
+
hover for popover
diff --git a/js/bootstrap-alerts.js b/js/bootstrap-alerts.js
index dbce13466f..9e8b307123 100644
--- a/js/bootstrap-alerts.js
+++ b/js/bootstrap-alerts.js
@@ -51,30 +51,25 @@
/* ALERT CLASS DEFINITION
* ====================== */
- var Alert = function ( content ) {
- var that = this
+ var Alert = function ( content, selector ) {
this.$element = $(content)
- .bind('alert:hide', $.proxy(this.close, this))
- .delegate('.close', 'click', function (e) {
- e.preventDefault()
- that.close()
- })
+ .delegate(selector || '.close', 'click', this.close)
}
Alert.prototype = {
- close: function () {
- var that = this
+ close: function (e) {
+ var $element = $(this).parent('.alert-message')
- this.$element.removeClass('in')
+ e && e.preventDefault()
+ $element.removeClass('in')
function removeElement () {
- that.$element.remove()
- that.$element = null
+ $element.remove()
}
- $.support.transition && this.$element.hasClass('fade') ?
- this.$element.bind(transitionEnd, removeElement) :
+ $.support.transition && $element.hasClass('fade') ?
+ $element.bind(transitionEnd, removeElement) :
removeElement()
}
@@ -85,9 +80,25 @@
* ======================= */
$.fn.alert = function ( options ) {
+
+ if ( options === true ) {
+ return this.data('alert')
+ }
+
return this.each(function () {
- new Alert(this)
+ var $this = $(this)
+
+ if ( typeof options == 'string' ) {
+ return $this.data('alert')[options]()
+ }
+
+ $(this).data('alert', new Alert( this ))
+
})
}
+ $(function () {
+ new Alert($('body'), '.alert-message[data-alert] .close')
+ })
+
})( jQuery || ender )
\ No newline at end of file
diff --git a/js/bootstrap-popover.js b/js/bootstrap-popover.js
index 4995fe5d89..bf1278325f 100644
--- a/js/bootstrap-popover.js
+++ b/js/bootstrap-popover.js
@@ -24,6 +24,7 @@
this.$element = $(element)
this.options = options
this.enabled = true
+ this.fixTitle()
}
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TWIPSY.js
@@ -38,22 +39,13 @@
$tip[0].className = 'popover'
}
- , fixTitle: function () {}
+ , getContent: function () {
+ var contentvar
+ , $e = this.$element
+ , o = this.options
- , getTitle: function () {
- var title
- if (typeof this.options.title == 'string') {
- title = this.$element.attr('data-title') || this.options.title
- } else if (typeof this.options.title == 'function') {
- title = this.options.title.call(this.$element[0])
- }
- return title
- }
-
- , getContent: function () {content
- var content
if (typeof this.options.content == 'string') {
- content = this.$element.attr('data-content') || this.options.content
+ content = $e.attr(o.content)
} else if (typeof this.options.content == 'function') {
content = this.options.content.call(this.$element[0])
}
@@ -80,6 +72,6 @@
return this
}
- $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'content', placement: 'right'})
+ $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'data-content', placement: 'right'})
})( jQuery || ender )
\ No newline at end of file
diff --git a/js/bootstrap-twipsy.js b/js/bootstrap-twipsy.js
index a227af4d28..977c2beb5f 100644
--- a/js/bootstrap-twipsy.js
+++ b/js/bootstrap-twipsy.js
@@ -282,9 +282,6 @@
this[binder](eventIn, enter)[binder](eventOut, leave)
}
- this.bind(name + ':show', enter)
- this.bind(name + ':hide', leave)
-
return this
}