MediaWiki:Common.js: Difference between revisions
Appearance
Content deleted Content added
No edit summary |
No edit summary |
||
| Line 67: | Line 67: | ||
}); |
}); |
||
mw.hook('wikipage.content').add(function($content) { |
|||
// Erkennt mobile Touch-Gesten |
|||
if ('ontouchstart' in window || navigator.maxTouchPoints > 0) { |
|||
// Sucht nach Ihrer CSS-Klasse (z. B. .wiki-tooltip) |
|||
$content.find('.wiki-tooltip').on('click', function(e) { |
|||
e.preventDefault(); |
|||
e.stopPropagation(); |
|||
// Holt sich das versteckte Kind-Element (den Tooltip-Text) |
|||
var $tooltipContent = $(this).find('.tooltip-content'); |
|||
// Wechselt die Sichtbarkeit bei jedem Klick/Tippen |
|||
$('.tooltip-content').not($tooltipContent).hide(); // Schließt andere offene Tooltips |
|||
$tooltipContent.toggle(); |
|||
}); |
|||
// Schließt das Tooltip-Fenster, wenn man irgendwo anders hinklickt |
|||
$(document).on('click', function() { |
|||
$('.tooltip-content').hide(); |
|||
}); |
|||
} |
|||
}); |
|||
/** |
/** |
||