source: other-projects/trunk/realistic-books/packages/AntInstaller/web/js/menu.js@ 19253

Last change on this file since 19253 was 19253, checked in by davidb, 15 years ago

Establishing a source code repository for Veronica's Realistic Book's software

File size: 852 bytes
Line 
1var WIDTH = 200;
2var showing = false;
3var contentsPanel = null;
4
5function toggleMenu(){
6 contentsPanel = document.getElementById('contents-panel');
7 toggleAnchor = document.getElementById('toggle');
8 if(showing) {
9 hideMenu();
10 showing = false;
11 toggleAnchor.innerHTML = "show menu";
12 }
13 else {
14 showMenu();
15 showing = true;
16 toggleAnchor.innerHTML = "hide menu";
17 }
18}
19
20function showMenu(){
21 if (contentsPanel.style.left != "0px") {
22 doShow(WIDTH * -1);
23 }
24}
25
26function hideMenu(){
27 if (contentsPanel.style.left != "- " + WIDTH + "px") {
28 doHide(0);
29 }
30}
31
32function doHide(pos){
33 contentsPanel.style.left = pos + "px";
34 if(pos >= WIDTH * -1){
35 pos = pos - 20;
36 setTimeout("doHide(" + pos + ")", 10);
37 }
38}
39function doShow(pos){
40 contentsPanel.style.left = pos + "px";
41 if(pos < 0){
42 pos = pos + 20;
43 setTimeout("doShow(" + pos + ")", 10);
44 }
45}
Note: See TracBrowser for help on using the repository browser.