SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Nov 2005
    0 Post(s)
    0 Thread(s)

    Question Adding image next to link

    If you look at the "shop by category" section of the link below, there are expandable menus displaying the categories. My problem is that the categories are links, so when one is selected, not only is it expanded but the page also reloads. How could I go about separating the bullet from the <li> and <a> elements so that when the bullet is clicked, it will expand the menu and if the actual name is selected, it will go to that category?

    I'd appreciate if someone could just point me in the right direction. Thanks.

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Hampshire UK
    182 Post(s)
    6 Thread(s)

    There is no real need for Kcup to be a link anyway because when js is disabled the menu is expanded by default. So you could use a span instead of an anchor and just style it to look the same.

    A quick fix would be just to remove the href destination.


    <li class="submenu"><a href="#nogo">KCup</a>
    Now when clicked it will not go anywhere. The semantic solution though is to change that anchor to a more suitable element such as a span or perhaps a heading tag of the appropriate level might be more appropriate.

    There is probably a JS solution also in making the link when clicked returned false so that it doesn't follow but that's a question for the JS forum.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts