• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Buried in cloud files? We can help with Spring cleaning!

    Whether you use Dropbox, Drive, G-Suite, OneDrive, Gmail, Slack, Notion, or all of the above, Dokkio will organize your files for you. Try Dokkio (from the makers of PBworks) for free today.

  • Dokkio (from the makers of PBworks) was #2 on Product Hunt! Check out what people are saying by clicking here.



Page history last edited by PBworks 16 years ago

Make an option to toggle contents on/off (Part I)


by vietmusic


Toggle Contents


Method 1

You know how Wikipedia has a collapsible table of contents? We can do something similar with a little ingenuity and some javascript. Just paste this in wherever your <toc> usually is:


<script language="javascript">
function toggleTOC() {
if (document.getElementById("mytoc").style.display!="none")
<a href="javascript:toggleTOC()">**Toggle Contents**</a><div id="mytoc" style="margin-top:-15px"><toc></div>




If you want neater code, put the stuff between <script></script> at the bottom of your page.


Now you'll have a link above your <toc> that allows you to turn it on and off.


Another way...


There's an option that's even slicker...go to page 2



Comments (0)

You don't have permission to comment on this page.