mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 21:21:50 +08:00
initial popover/tooltip config
This commit is contained in:
parent
54caa772d9
commit
9fd02e71c9
1 changed files with 29 additions and 0 deletions
29
app/assets/javascripts/sitewide/popover_helper.js
Normal file
29
app/assets/javascripts/sitewide/popover_helper.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
$(document).ready(function() {
|
||||
var hover_timer
|
||||
var text_to_display = $('.popover_v2').data('content')
|
||||
$('.popover_v2').popover({
|
||||
html: true,
|
||||
container: 'body',
|
||||
placement: 'auto right',
|
||||
trigger: 'manual',
|
||||
template: '<div class="popover" role="tooltip"><div class="popover-body">'+text_to_display+'</div></div>',
|
||||
}).on("mouseenter", function () {
|
||||
hover_timer = setTimeout(function () {
|
||||
$('.popover_v2').popover("show")
|
||||
}, 1000);
|
||||
$('body').find(".popover").on("mouseleave", function () {
|
||||
$('.popover_v2').popover('hide');
|
||||
});
|
||||
}).on("mouseleave", function () {
|
||||
clearTimeout(hover_timer)
|
||||
setTimeout(function () {
|
||||
if (!$(".popover:hover").length) {
|
||||
$('.popover_v2').popover("hide")
|
||||
}
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
}());
|
Loading…
Reference in a new issue