WikiEmbedWidgetTricks

To create a collapsible imbedded page, you'll need to create three pages. Two of the pages are generic and can be used by any wiki page. The page that actually contains the collapsing div needs to be specifically created for each embedded page to be collapsed.

1. Create a page to hold the WikiToggle function. Start a new page and name it something like HTML_WidgetEmbedCollapsiblePageFunction. Use the **Embed Widget** option and select **Other URL**. code  function wikiToggle(ItemID) { if( document.getElementById(ItemID).style.display=='none' ) { document.getElementById(ItemID).style.display = 'block'; }else{ document.getElementById(ItemID).style.display = 'none'; } } code Your new page will be a blank page. If you edit the page, you'll see code media type="custom" key="4282407" code The actual key number will differ from the number "4282407."

2. Create a page to hold the collapsible div function. __This is the page that must be specific to each url__. Name it something specific to the page to be opened. A new page must be created for each page to be collapsed. This is NOT the embedded page itself, merely the beginning of a div. Name it something specific for easier recall. This one is saved as HTML_DivEmbedCollapseBMR. code  document.write(' Show/Hide Basic Math Review Page ') document.write(' ') This page will show a non-functioning link to the target page. code

3. Create a page to hold the end div function. This is the second generic page and can be used to end div any collapsible embedded page. You can name it anything you like. HTML_WidgetEndDiv is a good choice. code  document.write(' ') This is another blank page. Like the first page, editing this page will show code media type="custom" key="4282407" code where the actual key number will differ from the number "4282407."

code

Once these three pages have been created, use the **Include** function to include the pages. The HTML_WidgetEmbedCollapsiblePage function only needs to be included once on the page.

code include page="HTML_WidgetEmbedCollapsiblePageFunction" include page="HTML_DivEmbedCollapseBMR" include page="BasicMathReview" include page="HTML_WidgetEndDiv" code Here is the example include page="HTML_WidgetEmbedCollapsiblePageFunction" include page="HTML_DivEmbedCollapseBMR" include page="BasicMathReview" include page="HTML_WidgetEndDiv"


 * Caveat: //A collapsible embedded page doesn't display / behave well during Preview Mode. If you do preview, you'll need to cancel out one or more "Navigate away from this page" warnings, which you can safely do and remain on the same page.  The included page __will be displayed__.  It isn't until you save the edits that you can see and test the functionality.//**

Thanks to user:lenva for inspiring this code and user:StPendl for the actual creation of the code.