CSS - Open submenu when menu Item Clicked


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: CSS - Open submenu when menu Item Clicked

  1. #1
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263

    CSS - Open submenu when menu Item Clicked

    I have a css file that I use when I need to have menus pop open when you mouse over them. I have modified it slightly to fit my new use for it but I can't figure out how to only open the submenu when you click on the menu item rather than mouse over it. I am creating some html help files and I wanted to add a Related Topics button, at the bottom of some pages. When clicked will popup a submenu of topics the user can link to. I have the button looking correct and the popup menu works great when I hover over the button. So all I need now is to figure out how to dump the hover behaviour, and switch it to open the menu when the user clicks on it instead.

    Thanks in advance for any help you can give!

  2. #2
    Join Date
    Jan 2005
    Posts
    413
    Unfortunately there is no onclick event handler in CSS, only the mouse over event handler known as hover. You might try putting the style rules for the open on a:active, but I'm not sure it will work practically

  3. #3
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263
    Not the cleanest way but with some experimenting it now works pretty well. The only real anomaly is the click itself. You can't just click the button and get the menu to stay open. The moment you let go of the mouse button the menu disappears; but if you simply click down and drag, even the tiniest amount, then you can let go and the menu stays open until you either select an option or click on the button again . So other than that it's very clean.
    Thanks!

Similar Threads

  1. Replies: 7
    Last Post: 08-15-2006, 03:21 PM
  2. Getting a GUI to run
    By Eric in forum Java
    Replies: 4
    Last Post: 04-14-2006, 09:09 AM
  3. Replies: 1
    Last Post: 09-08-2005, 01:23 PM
  4. Context menu manipulation
    By nnch97 in forum .NET
    Replies: 8
    Last Post: 07-02-2002, 02:09 PM
  5. Getting a GUI to function
    By Eric in forum Java
    Replies: 1
    Last Post: 11-27-2001, 06:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center