I’ve seen this very simple selectbox on youtube, where the select options are visible on hover (instead of clicking), as seen in following screenshot.

I’m trying to create similar effect in the following simple select box. Can someone please help how this can be done? Thanks.
<select name="size">
<option value="small">Small</option>
<option value="medium">Medium</option>
<option value="large">Large</option>
</select>
Here’s one way of doing it, though I’d prefer a more plug-in approach (rather than hard-coding the html
ul):JS Fiddle demo.
Edited to include an
alertdemonstrating the changes in theselectelement’s value: JS Fiddle demo.Edited to include the css and html used in the demo:
html
css:
This causes the menu to hide the
unselecteditems until theulis hovered over, then revealing all the options, and uses theclick()event to assign theunselectedclass name to the non-clicked elements; which allows the clicked element to be still visible on mouseout.The above CSS reflects the most-recent edit, to make the currently-selected, and
:hover-ed,limore visible.Latest JS Fiddle demo.
Edited because, well, I got a little bored. And had nothing better to do, so I made a simple plug-in:
JS Fiddle demo, including the ‘plug-in’.
Notes:
select(which you can certainly do, and works okay) it does screw with the page-flow a little (or a lot), but this can be amended in the CSS (I’d imagine, though I’ve not yet tried).dlelements to be used in place of the currentul, which would allow for giving an explanation of the available options.Edited because I felt that there should be a visible ‘guidance’ element, and also to try and explain something of how it all works.
Given the html:
Use the jQuery to call the plugin:
This takes the above select, and creates a
ulwith the following mark-up:The CSS used (in the demo):
JS Fiddle demo.