Last updated: 07 Jan 2011
Absolute Floating Menu Close Link/Button
The javascript demonstrated on this page is a close button/link option for the
Absolute Floating Menu
script. It can be placed on both page body and on the floating DIV itself.
Script demonstration
Click the buttons to show/hide the floating menu box.Show the floating menu Hide the floating menu
Script source code
To use the script perform the following steps:- Follow instructions on Absolute Floating Menu page.
- Insert the following code after the Absolute Floating Menu javascript code (or put in separate file and reference it):
<script type="text/javascript"><!--
/* Script by: www.jtricks.com
* Version: 20110107
* Latest version:
* www.jtricks.com/javascript/navigation/floating_close.html
*/
floatingMenu.hide = function()
{
floatingArray[0].menu.style.visibility='hidden';
return false;
}
floatingMenu.show = function()
{
floatingArray[0].menu.style.visibility='';
return false;
}
//--></script>
- When you need to hide the menu, call
floatingMenu.hide(). - When you need to show the menu again, call
floatingMenu.show(). For example:
<button onclick="floatingMenu.show()">Show</button> <button onclick="floatingMenu.hide()">Hide</button> <a href="#" onclick="return floatingMenu.show()">Show</a> <a href="#" onclick="return floatingMenu.hide()"">Hide</a>
Browser compatibility
The javascript snippet above was tested on the following user agents:| Mozilla/Netscape | Firefox 2.0.x | Ok. |
| Firefox 1.5 | Ok. | |
| Firefox 1.0.x | Ok. | |
| Microsoft | Internet Explorer 7.0 | Ok. |
| Internet Explorer 6.0 | Ok. | |
| Opera | Opera 9.x | Ok. |
| Opera 8.x | Ok. | |
| KHTML | Konqueror 3.5.5 | Ok. |
| Safari 3.1.2 | Ok. | |
| No Javascript or Javascript turned off |
Any | The show/hide effect just will not happen. |