Difference between revisions of "User:Knightmare/common.js"
Jump to navigation
Jump to search
Knightmare (talk | contribs) (Blanked the page) Tag: Blanking |
Knightmare (talk | contribs) |
||
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(); }); } }); } });