Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function turn_rm_toc_collapsable() {
- ?>
- <script>
- jQuery(document).ready(function() {
- var tocItems = jQuery("div.wp-block-rank-math-toc-block");
- tocItems.bind("click", function(event) {
- var nav = jQuery(this).find("nav");
- var tocHeading = jQuery(this).find("h2");
- if (nav.css("overflow") == "hidden") {
- nav.css("overflow", "visible");
- nav.css("max-height", "100vh");
- tocHeading.addClass("active"); // Add the "active" class
- } else {
- nav.css("overflow", "hidden");
- nav.css("max-height", "0");
- tocHeading.removeClass("active"); // Remove the "active" class
- }
- });
- });
- </script>
- <?php
- }
- add_action('wp_footer', 'turn_rm_toc_collapsable');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement