1
zzzzsg
Javascript collapsible menu in Custom block
  • 2009/5/27 0:01

  • zzzzsg

  • Just popping in

  • Posts: 86

  • Since: 2005/12/22


I plugged this Javascript collapsible script by Kyle Edwards from http://www.java-scripts.net/javascripts/Collapsible-Menu-Script.phtml to my custom block.
It works fine, but there is one problem.

After I click on one of the expanded menu items and get redirected to the link in the menu item, the parent menu will collapse (close). This is expected since XOOPS will reload to go to the XOOPS link in the menu item.

Question - how to create collapsible menu item in custom block which will not collapse when a expanded item is clicked?
For example
Parent Menu1
-> Child menu1 (goes to XOOPS page 1)
-> Child menu2 (goes to XOOPS page 2)
-> Child menu3 (goes to XOOPS page 3)
At first, Parent Menu1 link in the custom block is collapsed, i.e. Child menu1, Child menu2 and Child menu3 are not displayed.
Clicking on Parent Menu1 will cause it to expand, i.e., Child menu1, Child menu2 and Child menu3 will be displayed.
Clicking Child menu1 will cause the XOOPS page 1 to be displayed. But the Parent Menu1 should stay expanded, displaying all the child menus. Currently, my script will not let Parent Menu1 to stay expanded when a child link is clicked. This is expected since the Javascript has no memory (no cookies implemented here).

Is there a way to do this without cookies?
Use AJAX?

Previously, I used PHP in the custom block to display the child menus when the parent menu is clicked by checking the url. ( Okay I am now able to do this using PHP in custom block -- but it requires adding a querystring to the url for the toggling).

Is there any way to do this using Javascript (and without using cookies or adding a querystring)?

Thank you.


























2
zzzzsg
Re: Javascript collapsible menu in Custom block
  • 2009/6/8 17:41

  • zzzzsg

  • Just popping in

  • Posts: 86

  • Since: 2005/12/22


ok i am able to do this using jquery.

Login

Who's Online

381 user(s) are online (249 user(s) are browsing Support Forums)


Members: 0


Guests: 381


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits