mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
parent
5bdd5e02a4
commit
05c6e7dd66
@ -127,22 +127,24 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {HTMLButtonElement} btn
|
||||
* @param {string} selector
|
||||
* @param {string} title
|
||||
*/
|
||||
function snippetButtonTooltip(btn, title) {
|
||||
var tooltipBtn = new bootstrap.Tooltip(btn, { title: title })
|
||||
function snippetButtonTooltip(selector, title) {
|
||||
document.querySelectorAll(selector).forEach(function (btn) {
|
||||
var tooltipBtn = new bootstrap.Tooltip(btn, { title: title })
|
||||
|
||||
btn.addEventListener('mouseleave', function () {
|
||||
// Explicitly hide tooltip, since after clicking it remains
|
||||
// focused (as it's a button), so tooltip would otherwise
|
||||
// remain visible until focus is moved away
|
||||
tooltipBtn.hide()
|
||||
btn.addEventListener('mouseleave', function () {
|
||||
// Explicitly hide tooltip, since after clicking it remains
|
||||
// focused (as it's a button), so tooltip would otherwise
|
||||
// remain visible until focus is moved away
|
||||
tooltipBtn.hide()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
snippetButtonTooltip(document.querySelector('.btn-clipboard'), 'Copy to clipboard')
|
||||
snippetButtonTooltip(document.querySelector('.btn-edit'), 'Edit on Stackblitz')
|
||||
snippetButtonTooltip('.btn-clipboard', 'Copy to clipboard')
|
||||
snippetButtonTooltip('.btn-edit', 'Edit on Stackblitz')
|
||||
|
||||
var clipboard = new ClipboardJS('.btn-clipboard', {
|
||||
target: function (trigger) {
|
||||
|
Loading…
Reference in New Issue
Block a user