Difference between revisions of "MediaWiki:Gadget-TimelessSidebarDropdowns.js"
From Nookipedia, the Animal Crossing wiki
SuperHamster (talk | contribs) (Restore click instead of touchstart) |
SuperHamster (talk | contribs) (Remove extra selector for mw-portlet-body, not needed due to parent mw-portlet being selected) |
||
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
* Created by SuperHamster on Nookipedia (https://nookipedia.com/wiki/User:SuperHamster) | * Created by SuperHamster on Nookipedia (https://nookipedia.com/wiki/User:SuperHamster) | ||
* Licensed under CC BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0/) | * Licensed under CC BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0/) | ||
+ | * TODO: | ||
+ | * Make mobile-friendly (after opening a menu, clicking on header should close menu) | ||
**/ | **/ | ||
Line 11: | Line 13: | ||
} | } | ||
− | $('#site-navigation .sidebar-inner .mw-portlet:not(#p-navigation)').on(" | + | $('#site-navigation .sidebar-inner .mw-portlet:not(#p-navigation)').on("mouseover", function () { |
$(this).children('.mw-portlet-body')[0].style.display = 'block'; | $(this).children('.mw-portlet-body')[0].style.display = 'block'; | ||
}); | }); | ||
− | + | $('#site-navigation .sidebar-inner .mw-portlet:not(#p-navigation)').on("mouseleave", function () { | |
timer = setTimeout(hide($(this)), 10); | timer = setTimeout(hide($(this)), 10); | ||
}).mouseenter(function() { | }).mouseenter(function() { | ||
clearTimeout(timer); | clearTimeout(timer); | ||
}); | }); |
Latest revision as of 04:27, August 29, 2021
/**
* Turns each section in the Timeless sidebar into a dropdown menu.
* Created by SuperHamster on Nookipedia (https://nookipedia.com/wiki/User:SuperHamster)
* Licensed under CC BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0/)
* TODO:
* Make mobile-friendly (after opening a menu, clicking on header should close menu)
**/
var timer;
function hide(element) {
$(element).children('.mw-portlet-body')[0].style.display = "none"
}
$('#site-navigation .sidebar-inner .mw-portlet:not(#p-navigation)').on("mouseover", function () {
$(this).children('.mw-portlet-body')[0].style.display = 'block';
});
$('#site-navigation .sidebar-inner .mw-portlet:not(#p-navigation)').on("mouseleave", function () {
timer = setTimeout(hide($(this)), 10);
}).mouseenter(function() {
clearTimeout(timer);
});