The wiki is lacking in content. You can help by creating a new article. See the to do list for more ways you can help.
Difference between revisions of "MediaWiki:Gadget-ExplainTooltips.js"
From Final Fantasy Wiki
Jump to navigationJump to search
m (1 revision imported: Importing from the Kingdom Hearts Wiki) |
|
(No difference)
|
Latest revision as of 01:07, October 19, 2020
/* Make it so users can click on "explain" spans to toggle their content
Useful for mobile users, since there's no mouse-over */
function toggleExplain(e) {
var old = e.getAttribute('oldContent');
if (old && old.length > 0) {
e.innerHTML = old;
e.setAttribute('oldContent', '');
e.style.borderBottom = '1px dotted';
} else {
e.setAttribute('oldContent', e.innerHTML);
e.innerHTML = e.getAttribute('title');
e.style.borderBottom = '1px dashed';
}
}
$(function() {
if ('ontouchstart' in window || navigator.MaxTouchPoints > 0 || navigator.msMaxTouchPoints > 0) {
var explain_spans = document.getElementsByClassName('explain');
for (var e = 0; e < explain_spans.length; e++) {
explain_spans[e].onclick = function(){ toggleExplain(this) };
}
}
});