Difference between revisions of "User:Knightmare/common.js"

From ARMCO
Jump to navigation Jump to search
(Blanked the page)
Tag: Blanking
Line 1: Line 1:
$(document).ready(function() {
// Check if the TOC exists
var toc = $('#toc');
if (toc.length) {
toc.find('ul').hide(); // Hide the nested TOC levels

toc.find('li').each(function() {
var $li = $(this);
var $link = $li.find('a').first();
if ($link.length) {
// Add a click handler to toggle the nested TOC
$link.click(function() {
$li.children('ul').toggle();
});
}
});
}
});

Revision as of 16:14, 18 November 2024

$(document).ready(function() {
    // Check if the TOC exists
    var toc = $('#toc');
    if (toc.length) {
        toc.find('ul').hide(); // Hide the nested TOC levels

        toc.find('li').each(function() {
            var $li = $(this);
            var $link = $li.find('a').first();
            if ($link.length) {
                // Add a click handler to toggle the nested TOC
                $link.click(function() {
                    $li.children('ul').toggle();
                });
            }
        });
    }
});