/*http://stackoverflow.com/questions/9508029/dropdown-select-with-images*/
#image-dropdown {
/*style the "box" in its minimzed state*/
border:1px solid #33CC33;
width:104px;
height:104px;
overflow:hidden;
background-color: #CCC;
/*animate collapsing the dropdown from open to closed state (v. fast)*/
-moz-transition: height 0.1s;
-webkit-transition: height 0.1s;
-ms-transition: height 0.1s;
-o-transition: height 0.1s;
transition: height 0.1s;
}
#image-dropdown:hover {
/*when expanded, the dropdown will get native means of scrolling*/
height:300px;
width:110px;
overflow-y:scroll;
-moz-transition: height 0.5s;
-webkit-transition: height 0.5s;
-ms-transition: height 0.5s;
-o-transition: height 0.5s;
transition: height 0.5s;
}
#image-dropdown input {
/*hide the nasty default radio buttons. like, completely!*/
position:absolute;
top:0;
left:0;
opacity:0;
}
#image-dropdown label {
display:none;
margin:2px;
height:100px;
width:100px;
opacity:0.2;
/*background:url("https://placeimg.com/100/100/tech");*/
}
#image-dropdown label[for=line1] {
background-image:url("https://placeimg.com/100/100/nature");
}
#image-dropdown label[for=line2] {
background-image:url("https://placeimg.com/100/100/tech");
}
#image-dropdown label[for=line3] {
background-image:url("https://placeimg.com/100/100/people");
}
#image-dropdown:hover label {
/*this is how labels render in the "expanded" state. we want to see only the selected radio button in the collapsed menu, and all of them when expanded*/
display:block;
}
#image-dropdown label:hover {
opacity:0.5;
}
#image-dropdown input:checked + label {
/*tricky! labels immediately following a checked radio button (with our markup they are semantically related) should be fully opaque regardless of hover, and they should always be visible (i.e. even in the collapsed menu*/
opacity:1 !important;
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.