Created
March 15, 2013 14:25
-
-
Save jbatchelor/5170210 to your computer and use it in GitHub Desktop.
Trigger native mobile select list with a button click.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Nifty trick for using a native mobile select list but triggering it with a button click: | |
Given: | |
<div class="box"> | |
<i class="my-icon"/> | |
<select class="multi" multiple="true"> | |
<option>1</option> | |
<option>2</option> | |
<option>3</option> | |
</select> | |
</div> | |
It can be styled thus: | |
.box { | |
position:relative; | |
} | |
.box select { | |
position:absolute; | |
top:0; | |
left:0; | |
width:50px; // this is arbitrary ... choose a size that fits in your box | |
height:50px; // ditto to width | |
opacity:0; // makes the native box disappear, but doesn't remove it from the document flow | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment