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

  • Whenever you search in PBworks, Dokkio Sidebar (from the makers of PBworks) will run the same search in your Drive, Dropbox, OneDrive, Gmail, and Slack. Now you can find what you're looking for wherever it lives. Try Dokkio Sidebar for free.

View
 

vietmusic_togglecontents

This version was saved 16 years, 7 months ago View current version     Page history
Saved by PBworks
on May 10, 2006 at 9:04:11 am
 

 

Make an option to toggle contents on/off

 

by vietmusic

 

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 whereever your <toc> usually is:

 

<script language="javascript">
function toggleTOC() {
if (document.getElementById("mytoc").style.display!="none")
document.getElementById("mytoc").style.display="none";
else
document.getElementById("mytoc").style.display="block";
}
</script>
<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.

 

Example:

 

Toggle Contents

 

What's up?

 

Doing well

 

Dude

 

Here I am

 

Comments (0)

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