Close Button at bottom of pull-downs
Close Button at bottom of pull-downs
Is there a simple way that I can add an image to the bottom of a menu that would close the menu when clicked?
I'm not sure I get that. If the menu you're opening is always visible, then how are you opening it with code in an aI() string? I.e., if the menu is alwasyvisible=1 from the start, then it will be open when the page loads.dhyman wrote:alwaysvisible=1 and opened with an aI()
Can you post a url to an example page or, if you can't do that, can you post some sample code showing (1) code for the menu that's open (the one you want to close) and (2) code that opened the menu in the first place.
Cheers,
Kevin
Hi dhyman,
Sorry to leave you hanging. As John said, I was out for a while.
I suppose it depends on whether you want to (a) close only the submenu that contains the "close" item that is clicked, or (b) close the entire submenu hierarchy up to and including the one containing the "close" item that is clicked, leaving the main menu open.
I'd write a function to do either. Let's call the function mm_closeClickedMenu().
In the case of (a) above, the menu definition might be:You could include the code at the top of your menu_data.js file. This function would close only the menu containing the clicked "close" item.
In the case of (b) above, the function would be:This version would close all currently open submenus, leaving the main menu open.
Both functions are the same function name, but with different innards, depending on what you want to do ("innards" is, of course, a technical term).
The menu item to call the function would look like:
or
...your preference. Either one should work the same.
Of course, if you want to close all of the submenus, you could just call closeAllMenus() directly, rather than wrapping it up in the mm_closeClickedMenu() function. But the advantages of a function wrapper are (1) you can play with the essential functions (e.g., close one or close all) to see which you like better, and (2) you can add more code to it later if you want to do something else besides close the menus when those particular items are clicked.
Hope that helps,
Kevin
Sorry to leave you hanging. As John said, I was out for a while.
I suppose it depends on whether you want to (a) close only the submenu that contains the "close" item that is clicked, or (b) close the entire submenu hierarchy up to and including the one containing the "close" item that is clicked, leaving the main menu open.
I'd write a function to do either. Let's call the function mm_closeClickedMenu().
In the case of (a) above, the menu definition might be:
Code: Select all
function mm_closeClickedMenu()
{
menuDisplay(_mi[_itemRef][0], 0);
}
In the case of (b) above, the function would be:
Code: Select all
function mm_closeClickedMenu()
{
closeAllMenus();
}
Both functions are the same function name, but with different innards, depending on what you want to do ("innards" is, of course, a technical term).
The menu item to call the function would look like:
Code: Select all
aI("text=Close;clickfunction=mm_closeClickedMenu();");
Code: Select all
aI("text=Close;url=javascript:mm_closeClickedMenu();");
Of course, if you want to close all of the submenus, you could just call closeAllMenus() directly, rather than wrapping it up in the mm_closeClickedMenu() function. But the advantages of a function wrapper are (1) you can play with the essential functions (e.g., close one or close all) to see which you like better, and (2) you can add more code to it later if you want to do something else besides close the menus when those particular items are clicked.
Hope that helps,
Kevin
Hi,
You should be able to use the structure for an image instead of text in the aI string.
Ruth
You should be able to use the structure for an image instead of text in the aI string.
Code: Select all
aI("image=whateverimage;clickfunction=mm_closeClickedMenu();");