wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Drop down without JavaScript" Watch "Drop down without JavaScript" New topic
Author

Drop down without JavaScript

Pelle Sundqvist
Greenhorn

Joined: Jun 24, 2012
Posts: 12
I want this dropdown: http://freshdesignweb.com/demo/2012/09/drop-down-responsive-menu/ 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
author
Ranch Hand

Joined: Nov 06, 2012
Posts: 295
    
    5

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Drop down without JavaScript
 
Similar Threads
Problem in drop down box
drop-down list / textbox
onselect / onchange ????
Accessible, all CSS, cross-browser dropdown menus?
Populating a combobox dinamically from a database