Loading ...
Sorry, an error occurred while loading the content.
 

Suggestion re context menu

Expand Messages
  • sgraysv
    Hi, I have a suggestion re icons in context menus. The only way to add an icon to a context menu item is to define a custom style and set the url in the
    Message 1 of 3 , Aug 2, 2007
      Hi, I have a suggestion re icons in context menus. The only way to add
      an icon to a context menu item is to define a custom style and set the
      url in the background property, then apply the style to your menu item
      using the classname property. The problem is that the .yui-skin-sam
      .yuimenuitem a.selected setting in menu.css also sets the background
      proeprty so that the background of the item is blue when the mouse is
      hovering over it. This means that when the mouse is hovering over the
      item, the background setting for the .yui-skin-sam .yuimenuitem
      a.selected style overrides the background setting for your custom
      style and the icon disappears. I have found no way around this.
      Perhaps a better way to do this might be to add an "icon" property to
      the menu item object, and use an img tag to implement? Thanks, Steve
    • Todd Kloots
      sgraysv - Thanks for the suggestion. However, i don t feel like an icon property is necessary when this can be achieved using CSS. All you need to do is
      Message 2 of 3 , Aug 3, 2007
        "sgraysv" -

        Thanks for the suggestion. However, i don't feel like an "icon"
        property is necessary when this can be achieved using CSS.

        All you need to do is make sure that the custom rules that you create
        for your icons have a higher specificity than that of the default rules
        applied by the Sam Skin. The following example demonstrates how this
        can be accomplished:

        http://developer.yahoo.com/yui/examples/menu/programsmenu_source.html

        - Todd

        sgraysv wrote:
        >
        > Hi, I have a suggestion re icons in context menus. The only way to add
        > an icon to a context menu item is to define a custom style and set the
        > url in the background property, then apply the style to your menu item
        > using the classname property. The problem is that the .yui-skin-sam
        > .yuimenuitem a.selected setting in menu.css also sets the background
        > proeprty so that the background of the item is blue when the mouse is
        > hovering over it. This means that when the mouse is hovering over the
        > item, the background setting for the .yui-skin-sam .yuimenuitem
        > a.selected style overrides the background setting for your custom
        > style and the icon disappears. I have found no way around this.
        > Perhaps a better way to do this might be to add an "icon" property to
        > the menu item object, and use an img tag to implement? Thanks, Steve
        >
        >
      • sgraysv
        Thanks Todd, that s very helpful, Steve
        Message 3 of 3 , Aug 3, 2007
          Thanks Todd, that's very helpful,
          Steve

          --- In ydn-javascript@yahoogroups.com, Todd Kloots <kloots@...> wrote:
          >
          > "sgraysv" -
          >
          > Thanks for the suggestion. However, i don't feel like an "icon"
          > property is necessary when this can be achieved using CSS.
          >
          > All you need to do is make sure that the custom rules that you create
          > for your icons have a higher specificity than that of the default rules
          > applied by the Sam Skin. The following example demonstrates how this
          > can be accomplished:
          >
          > http://developer.yahoo.com/yui/examples/menu/programsmenu_source.html
          >
          > - Todd
          >
          > sgraysv wrote:
          > >
          > > Hi, I have a suggestion re icons in context menus. The only way to add
          > > an icon to a context menu item is to define a custom style and set the
          > > url in the background property, then apply the style to your menu item
          > > using the classname property. The problem is that the .yui-skin-sam
          > > .yuimenuitem a.selected setting in menu.css also sets the background
          > > proeprty so that the background of the item is blue when the mouse is
          > > hovering over it. This means that when the mouse is hovering over the
          > > item, the background setting for the .yui-skin-sam .yuimenuitem
          > > a.selected style overrides the background setting for your custom
          > > style and the icon disappears. I have found no way around this.
          > > Perhaps a better way to do this might be to add an "icon" property to
          > > the menu item object, and use an img tag to implement? Thanks, Steve
          > >
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.