mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-26 05:19:15 +02:00
adds popover js
This commit is contained in:
28
examples/assets/js/bootstrap-twipsy.js
vendored
28
examples/assets/js/bootstrap-twipsy.js
vendored
@@ -44,18 +44,16 @@
|
||||
Twipsy.prototype = {
|
||||
|
||||
show: function() {
|
||||
var title = this.getTitle()
|
||||
, pos
|
||||
var pos
|
||||
, actualWidth
|
||||
, actualHeight
|
||||
, placement
|
||||
, $tip
|
||||
, tp
|
||||
|
||||
if (title && this.enabled) {
|
||||
if (this.getTitle() && this.enabled) {
|
||||
$tip = this.tip()
|
||||
$tip.find('.twipsy-inner')[this.options.html ? 'html' : 'text'](title)
|
||||
$tip[0].className = 'twipsy'
|
||||
this.setContent()
|
||||
$tip
|
||||
.remove()
|
||||
.css({ top: 0, left: 0, display: 'block' })
|
||||
@@ -92,6 +90,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
, setContent: function () {
|
||||
var $tip = this.tip()
|
||||
$tip.find('.twipsy-inner')[this.options.html ? 'html' : 'text'](this.getTitle())
|
||||
$tip[0].className = 'twipsy'
|
||||
}
|
||||
|
||||
, hide: function() {
|
||||
var that = this
|
||||
, $tip = this.tip()
|
||||
@@ -174,10 +178,14 @@
|
||||
}
|
||||
|
||||
|
||||
/* MODAL PLUGIN DEFINITION
|
||||
* ======================= */
|
||||
/* TWIPSY PLUGIN DEFINITION
|
||||
* ======================== */
|
||||
|
||||
$.fn.twipsy = function(options) {
|
||||
$.fn.twipsy = function (options) {
|
||||
$.fn.twipsy.initWith.call(this, options, Twipsy)
|
||||
}
|
||||
|
||||
$.fn.twipsy.initWith = function (options, Constructor) {
|
||||
|
||||
var twipsy
|
||||
, binder
|
||||
@@ -200,7 +208,7 @@
|
||||
var twipsy = $.data(ele, 'twipsy')
|
||||
|
||||
if (!twipsy) {
|
||||
twipsy = new Twipsy(ele, $.fn.twipsy.elementOptions(ele, options))
|
||||
twipsy = new Constructor(ele, $.fn.twipsy.elementOptions(ele, options))
|
||||
$.data(ele, 'twipsy', twipsy)
|
||||
}
|
||||
|
||||
@@ -253,6 +261,8 @@
|
||||
return this
|
||||
}
|
||||
|
||||
$.fn.twipsy.Twipsy = Twipsy
|
||||
|
||||
$.fn.twipsy.defaults = {
|
||||
delayIn: 0
|
||||
, delayOut: 0
|
||||
|
Reference in New Issue
Block a user