MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
m (Fix typo) |
m (Fix .hover-link handler) |
||
Line 2: | Line 2: | ||
$('span.hover-link').hover(function(e){ | $('span.hover-link').hover(function(e){ | ||
var classes = $(this).attr("class").split(/\s+/); | var classes = $(this).attr("class").split(/\s+/); | ||
for (var i=0; i<classes.length; i++) | for (var i=0; i<classes.length; i++) | ||
Line 10: | Line 7: | ||
if (classes[i].indexOf("link-") != -1) | if (classes[i].indexOf("link-") != -1) | ||
{ | { | ||
$("span."+classes[i]). | if (e.type == "mouseenter") | ||
{ | |||
$("span."+classes[i]).addClass("hover"); | |||
} | |||
else if (e.type == "mouseleave") | |||
{ | |||
$("span."+classes[i]).removeClass("hover"); | |||
} | |||
} | } | ||
} | } |
Revision as of 13:42, March 28, 2016
$(document).ready(function(){ $('span.hover-link').hover(function(e){ var classes = $(this).attr("class").split(/\s+/); for (var i=0; i<classes.length; i++) { if (classes[i].indexOf("link-") != -1) { if (e.type == "mouseenter") { $("span."+classes[i]).addClass("hover"); } else if (e.type == "mouseleave") { $("span."+classes[i]).removeClass("hover"); } } } }); });