File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Drop down without JavaScript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Drop down without JavaScript" Watch "Drop down without JavaScript" New topic

Drop down without JavaScript

Pelle Sundqvist

Joined: Jun 24, 2012
Posts: 12
I want this dropdown: to work without JavaScript enabled in your browser. What does not work without JavaScript is submenus do not want to be seen. I want to either be able to click on the "Portfolio" or "Blog" to see the submenus or that it just works without JavaScript.
Rob Crowther
Ranch Hand

Joined: Nov 06, 2012
Posts: 297

If you want to do something on a click then you have to use JavaScript, CSS can't do anything with click events.

The original CSS only drop down menu was Suckerfish (now Son of Suckerfish), but, because they rely on :hover they don't work in oldIE without JavaScript and don't work well on touch devices.

A good approach here is to make sure that without JavaScript enabled all the menu items are visible by default, then use JavaScript to build the drop down menu out of page content, applying CSS and event handlers as necessary. You can then use the JavaScript to feature detect and tune the menu for each device/browser, but the menu will still work without JavaScript.

Read my books: Hello! HTML5 & CSS3 | HTML5 in Action | Read my blog
I agree. Here's the link:
subject: Drop down without JavaScript
It's not a secret anymore!