mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-28 07:39:57 +02:00
add template option and make title an optional attribute for popover
This commit is contained in:
11
js/bootstrap-popover.js
vendored
11
js/bootstrap-popover.js
vendored
@@ -41,6 +41,10 @@
|
||||
$tip[0].className = 'popover'
|
||||
}
|
||||
|
||||
, hasContent: function () {
|
||||
return this.getTitle() || this.getContent()
|
||||
}
|
||||
|
||||
, getContent: function () {
|
||||
var content
|
||||
, $e = this.$element
|
||||
@@ -57,7 +61,7 @@
|
||||
, tip: function() {
|
||||
if (!this.$tip) {
|
||||
this.$tip = $('<div class="popover" />')
|
||||
.html('<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>')
|
||||
.html(this.options.template)
|
||||
}
|
||||
return this.$tip
|
||||
}
|
||||
@@ -74,6 +78,9 @@
|
||||
return this
|
||||
}
|
||||
|
||||
$.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { placement: 'right'})
|
||||
$.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
|
||||
placement: 'right'
|
||||
, template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
|
||||
})
|
||||
|
||||
}( window.jQuery || window.ender );
|
9
js/bootstrap-twipsy.js
vendored
9
js/bootstrap-twipsy.js
vendored
@@ -72,7 +72,7 @@
|
||||
, $tip
|
||||
, tp
|
||||
|
||||
if (this.getTitle() && this.enabled) {
|
||||
if (this.hasContent() && this.enabled) {
|
||||
$tip = this.tip()
|
||||
this.setContent()
|
||||
|
||||
@@ -145,6 +145,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
, hasContent: function () {
|
||||
return this.getTitle()
|
||||
}
|
||||
|
||||
, getTitle: function() {
|
||||
var title
|
||||
, $e = this.$element
|
||||
@@ -165,7 +169,7 @@
|
||||
|
||||
, tip: function() {
|
||||
if (!this.$tip) {
|
||||
this.$tip = $('<div class="twipsy" />').html('<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>')
|
||||
this.$tip = $('<div class="twipsy" />').html(this.options.template)
|
||||
}
|
||||
return this.$tip
|
||||
}
|
||||
@@ -296,6 +300,7 @@
|
||||
, offset: 0
|
||||
, title: 'title'
|
||||
, trigger: 'hover'
|
||||
, template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
|
||||
}
|
||||
|
||||
$.fn.twipsy.elementOptions = function(ele, options) {
|
||||
|
Reference in New Issue
Block a user