mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-20 12:21:35 +02:00
docs: add a StackBlitz "Try It" button in code examples (#35644)
Co-authored-by: GeoSot <geo.sotis@gmail.com> Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
@@ -125,17 +125,24 @@
|
||||
element.insertAdjacentHTML('beforebegin', btnHtml)
|
||||
})
|
||||
|
||||
document.querySelectorAll('.btn-clipboard')
|
||||
.forEach(function (btn) {
|
||||
var tooltipBtn = new bootstrap.Tooltip(btn, { title: btnTitle })
|
||||
/**
|
||||
*
|
||||
* @param {HTMLButtonElement} btn
|
||||
* @param {string} title
|
||||
*/
|
||||
function snippetButtonTooltip(btn, title) {
|
||||
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')
|
||||
|
||||
var clipboard = new ClipboardJS('.btn-clipboard', {
|
||||
target: function (trigger) {
|
||||
|
Reference in New Issue
Block a user