Created by Jonathan Gutow <gutow@uwos.edu> 9-2026
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.
You can try the dropdown menus here and the select dropdown here.
<li>. So, formatting, images, etc. are allowed.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.
<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>
<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>
<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>
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>
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:
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.