Mouse over the above menu to see the change.
Swap Text takes two global variables and two small functions.
- mm_onText() takes one parameter, rollOnText, which is the text that you want to substitiue into the menu item in the onmouseover state. Call mm_onText() from the menu item's onfunction property.
- mm_offText() takes no parameters and should automatically restore the "rolled" item's original text onmouseout. Call mm_offText() from the menu item's offfunction property.
- The function can be applied in as many items as wanted.
- Unless you match the two different texts as to length, you will need to specify an item width. If you don't fix the item's width to accomodate the wider of "on text" and "off text", then the item will fluctuate in size for mouseOn and mouseOut states and make the menu look as if it is shifting. If you specify a width, using align=center in the item will keep it looking uniform on mouseOver / mouseOut
To implement Swap Text:
- Place the following code at the top of the menu_data.js file
var mm_rollOffText; var mm_rollItem; function mm_onText(rollOnText) { mm_rollItem = _itemRef; mm_rollOffText = _mi[mm_rollItem][1]; _mi[mm_rollItem][1] = rollOnText; BDMenu(_mi[mm_rollItem][0]); itemOn(mm_rollItem); } function mm_offText() { _mi[mm_rollItem][1] = mm_rollOffText; BDMenu(_mi[mm_rollItem][0]); itemOff(mm_rollItem); }
- Call the function in the aI string. [no line breaks]
aI("text=Point at me;url=whatever.htm; onfunction=mm_onText('Now click me');offfunction=mm_offText();");