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

From ARMCO
Jump to navigation Jump to search
(Created page with "$(document).ready(function() { // Check if the TOC exists var toc = $('#toc'); if (toc.length) { toc.find('ul').hide(); // Hide the nested TOC levels...")
(No difference)

Revision as of 16:13, 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();
                });
            }
        });
    }
});