Rankmath Table Of Contents Style

#646312
  • Resolved Kumar Abhiii
    Rank Math free

    I want to add toggle button in table of contents. when user click on button or heading then toc will toggle and show the contents of table. and when user again click on heading then again table will toggle and all toc contents will be hide.

    I have try this below code but its not working properly in generatepress theme

    .wp-block-rank-math-toc-block {
    position: relative;
    }

    .wp-block-rank-math-toc-block h2 {
    background: #f7dab7;
    padding: 10px 12px 10px 18px;
    cursor: pointer;
    font-size: 18px !important;
    font-weight: normal !important;
    position: relative;
    margin-bottom: 0;
    }

    .wp-block-rank-math-toc-block h2:before {
    display: inline-block;
    content: "";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0px 6px 12px;
    border-color: transparent transparent transparent #000000;
    margin-right: 8px;
    transition: all linear .3s;
    }

    .wp-block-rank-math-toc-block h2.active:before {
    transform: rotate(90deg);
    }

    .wp-block-rank-math-toc-block nav {
    padding: 10px 10px 0px 10px;
    max-height: 0;
    overflow: hidden;
    transition: all linear .3s;
    }

    .wp-block-rank-math-toc-block input:checked + h2 ~ nav {
    max-height: 100vh;
    overflow: visible;
    }

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math support and we apologize for the inconvenience.

    The code you have shared is only for changing the appearance of the table of contents, not for adding a toggle function. To achieve what you want, you need to add some additional code to the functions.php file of your theme.

    Here’s the code you need to add: https://i.rankmath.com/n/G4ktKN

    You can keep the same CSS code you have used before.

    We hope this helps you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Rankmath Table Of Contents Style’ is closed to new replies.