aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <s1lv10@uol.com.br>2009-10-01 12:27:59 -0300
committerSilvio <s1lv10@uol.com.br>2009-10-01 12:27:59 -0300
commit5b98f9e4c97b9ddcf9590d5092224d06865f32d9 (patch)
treed8aca1942262e88a87b3cc6c0e72c280ddb7cf8b
parentc9f27086831124271f81adcfb4b944f1b2da3129 (diff)
downloadfinder_menu-5b98f9e4c97b9ddcf9590d5092224d06865f32d9.tar.gz
finder_menu-5b98f9e4c97b9ddcf9590d5092224d06865f32d9.tar.bz2
Initial code to hide the menu (3)
-rw-r--r--finder_menu.js46
1 files changed, 25 insertions, 21 deletions
diff --git a/finder_menu.js b/finder_menu.js
index a03db53..7f08a94 100644
--- a/finder_menu.js
+++ b/finder_menu.js
@@ -59,30 +59,34 @@ function ul2finder()
if(uls[i].getElementsByTagName('ul')[j] ==
this.parentNode.getElementsByTagName('ul')[0])
{
- if (window.finderOpened[i] == false) {
- window.finderOpened[i] = true;
- found=true;
- break;
- }
+ found=true;
+ break;
}
}
- // and hide all others
- if(!found)
- {
- cssjs('add',uls[i],hideClass);
- cssjs('remove',uls[i],showClass);
- cssjs('remove',uls[i].parentNode.getElementsByTagName('a')[0],openClass);
- cssjs('add',uls[i].parentNode.getElementsByTagName('a')[0],parentClass);
- } else {
- window.finderOpened[i] = false;
- cssjs('remove',uls[i].parentNode.getElementsByTagName('a')[0],parentClass);
- }
- }
- // change the current link from parent to open
- cssjs('swap',this,parentClass,openClass)
- // show the current nested list
- cssjs('add',this.parentNode.getElementsByTagName('ul')[0],showClass)
+ // and hide all others
+ if(!found)
+ {
+ cssjs('add',uls[i],hideClass)
+ cssjs('remove',uls[i],showClass)
+ cssjs('remove',uls[i].parentNode.getElementsByTagName('a')[0],openClass)
+ cssjs('add',uls[i].parentNode.getElementsByTagName('a')[0],parentClass)
+ }
+ }
+
+ if (window.finderOpened[i] == false) {
+ window.finderOpened[i] = true;
+ // change the current link from parent to open
+ cssjs('swap',this,parentClass,openClass);
+ // show the current nested list
+ cssjs('add',this.parentNode.getElementsByTagName('ul')[0],showClass);
+ } else {
+ window.finderOpened[i] = false;
+ // change the current link from open to parent
+ cssjs('swap',this,openClass,parentClass);
+ // hide the current nested list
+ cssjs('add',this.parentNode.getElementsByTagName('ul')[0],hideClass);
+ }
// don't follow the real HREF of the link
return false;