Minimalist_html_menu_and_select

Minimalist HTML Menu and Select Dropdowns with Formattable Content

Created by Jonathan Gutow <gutow@uwos.edu> 9-2026

Introduction

These dropdown menu and select dropdown templates were created to facilitate the updatiang of my tutorials to help people visualize atomic orbiatals , hybrid orbitals and multiple bonds. These tutorials make use of JSmol to provide interactive 3-D representations of electron orbitals on atoms and molecules. This requires extensive use of the Jmol scripting language. The menus are used to provide the user with simple selections to activate the specialized script calls. Typical html DOM built-ins such as <select> do not presently allow for formatting of text or inclusion of images, etc. in the dropdowns. This is my solution until browsers all consistently implement placement of popover elements.

Capabilities

You can try the dropdown menus here and the select dropdown here.

Usage

The menus and selection dropdowns are specified in html as unordered lists, <ul>. Each entry in the list is an item for the menu or selection list. The menu behavior takes advantage of css response to the state of hidden checkboxes.

Specifying a menu

A main (outer) menu

<ul id="menuname" class="menuList mainmenu">
    /* id of <input> must extend menu id as shown below */
  <input type="checkbox" id="menuname_check"/>
  <label for="menuname_check">Displayed Menu Label</label>
  <li id="itemname">a menu item</li>
  <li...
</ul>

A submenu

<ul id="menuname" class="menuList mainmenu">
  /* id of <input> must extend menu id as shown below */
  <input type="checkbox" id="menuname_check"/>
  <label for="menuname_check">Displayed Menu Label</label>
  <li id="itemname">a menu item</li>
  <li>
    <ul id="submenuname" class="menuList submenu">
        /* id of <input> must extend submenu id as shown below */
      <input type="checkbox" name="submenu" id="submenuname_check"/>
      <label for="submenuname_check">Item 1</label>
      <li id="2_2_1_1">Item 1</li>
    </ul>
  </li>
</ul>

Specifying a selection dropdown

<ul id="selectname" class="selectOneList mainmenu">
  /* id of <input> must extend select id as shown below */
  <input type="checkbox" name="menus" id="selectname_check"/>
  <label for="selectname_check">Orbital</label>
  <li class="selected defaultselection">None</li>
  <li id="itemname" >x<sup>2</sup></li>
  <li...
</ul>

Complex menu/select items

If a menu item is built from multiple elements (e.g. <div></div>’s) it is necessary to add the special class name complexMenuItem to each of the elements so how they are wrapped, etc. in the menu item can be controlled. The included css puts these elements all in one line.

<li id="red_blue_color" class="selected defaultselection">
  <div class="colorbox red complexMenuItem"></div>
  <div class="colorbox blue complexMenuItem"></div>
  Red/Blue
</li>

Formatting

The formatting is all controlled by the css style sheets. There are currently three (min_accord_selectone.css, min_accord_menu.css and min_accord_selectone_demo_ext.css). Notes on getting menus to overlay content below them:

Actions in response to selection of an item from the menu or selector

These need to be javascript calls from either the doMenuItem or doSelectOne functions in src/min_accord_menu.js. The expectation is that anyone using this code will build on the code in this js file. To keep the code light weight this is not written as a library with a callback handler.