MediaWiki:Gadget-Tooltip.js: Difference between revisions

Jump to navigation Jump to search
Kuhlau (talk | contribs)
Undid revision 9625 by Kuhlau (talk)
Kuhlau (talk | contribs)
No edit summary
 
Line 4: Line 4:
});
});


// Auto-positioning of floating tooltips, on desktop/hoverable only (maybe need to refine by skin so that it matches the css?)
// Auto-positioning of floating tooltips, on desktop only
if (mw.config.get('skin') !== 'minerva') {
if (mw.config.get('skin') !== 'minerva') {
mw.loader.using('oojs-ui-widgets').then(() => { // make sure the PopupWidget library is loaded
mw.loader.using('oojs-ui-widgets').then(() => { // make sure the PopupWidget library is loaded
Line 25: Line 25:
$content: $('<div>', { html: $content.html() }),
$content: $('<div>', { html: $content.html() }),
$container: $('body'),
$container: $('body'),
$floatableContainer: $toggle,
anchor: true, // !isEE
anchor: true, // !isEE
});
});
Line 34: Line 35:
// [[T:Tt]]'s toggle effect
// [[T:Tt]]'s toggle effect
$wrapper.append(popup.$element);
$(document.body).append(popup.$element);
$toggle.on('click', ()=> { popup.toggle() });
$toggle.on('click', ()=> { popup.toggle() });