40 lines
615 B
JavaScript
40 lines
615 B
JavaScript
|
//
|
||
|
// Popover
|
||
|
//
|
||
|
|
||
|
'use strict';
|
||
|
|
||
|
var Popover = (function() {
|
||
|
|
||
|
// Variables
|
||
|
|
||
|
var $popover = $('[data-toggle="popover"]'),
|
||
|
$popoverClass = '';
|
||
|
|
||
|
|
||
|
// Methods
|
||
|
|
||
|
function init($this) {
|
||
|
if ($this.data('color')) {
|
||
|
$popoverClass = 'popover-' + $this.data('color');
|
||
|
}
|
||
|
|
||
|
var options = {
|
||
|
trigger: 'focus',
|
||
|
template: '<div class="popover ' + $popoverClass + '" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'
|
||
|
};
|
||
|
|
||
|
$this.popover(options);
|
||
|
}
|
||
|
|
||
|
|
||
|
// Events
|
||
|
|
||
|
if ($popover.length) {
|
||
|
$popover.each(function() {
|
||
|
init($(this));
|
||
|
});
|
||
|
}
|
||
|
|
||
|
})();
|