Change the hover style on the ContextMenu
Today I had a request regarding the ContextMenu. The person wanted to know how to change the text appearance when the user moves their mouse over a menu item. Each MenuItem item is rendered inside a DIV as text, here is the code for emitting a MenuItem:
var s = "<div class=\"MarkItUp_ContextMenu_MenuItemBar MarkItUp_ContextMenu_MenuItem\" " + " onClick=\"javascript: MarkItUp_ContextMenu_HandleItemClick( this, " + delegateFunction + ", '" + this.Menu.LinkArgument + splitChars + this.CommandArgument + "' ) ; " + " event.cancelBubble = true ; \"" + " onMouseOut=\"javascript: MarkItUp_ContextMenu_MenuItemOver(this, 'out') ; " + " document.onmousedown = MarkItUp_ContextMenu_HandleDocumentClick ;\" " + " onMouseOver=\"javascript: MarkItUp_ContextMenu_MenuItemOver(this, 'over') ; " + " document.onmousedown = null;\"" + ">" + this.DisplayName + "</div>" ;
... as you can see, there is a handler hooked up to the onMouseOver and onMouseOut events of the DIV. That handler is contained in the .js file which comes with the project and contains the following code:
// private member function MarkItUp_ContextMenu_MenuItemOver( e, dir ) { if(dir == "over" ) e.className = "MarkItUp_ContextMenu_MenuItemBar_Over MarkItUp_ContextMenu_MenuItem_Over" ; else e.className = "MarkItUp_ContextMenu_MenuItemBar MarkItUp_ContextMenu_MenuItem" ; }
Therefore, to affect the text on a mouseover, you can simply change the styles in the MarkItUp_ContextMenu_MenuItem_Over class definition.