Skip to content

Instantly share code, notes, and snippets.

@oleksapro
Last active August 29, 2015 14:27
Show Gist options
  • Save oleksapro/e2246d7663e544f5b864 to your computer and use it in GitHub Desktop.
Save oleksapro/e2246d7663e544f5b864 to your computer and use it in GitHub Desktop.
css
http://bavotasan.com/2011/style-select-box-using-only-css/
<select name="timepass" class="fast-approval__select">
<option>Суточная посещаемость Вашего сайта</option>
<option>Driving</option>
<option>Internet</option>
<option>Movie</option>
<option>Music</option>
<option>Reading</option>
<option>Sports</option>
</select>
.select-wrapper {
background-color: #fff;
border-radius: 12px;
color: #929292;
display: inline-block;
position: relative;
width: 100%;
}
.select-wrapper__holder {
display: block;
font-size: 18px;
line-height: 22px;
margin: 0 10px 0 20px;
padding: 8px 0;
text-align: left;
}
.select-wrapper__holder:after {
background-image: url(../img/sprite.png);
background-position: 0 500px;
bottom: 0;
content: "";
height: 10px;
margin: auto;
position: absolute;
right: 12px;
top: 0;
width: 17px;
}
.fast-approval__select {
cursor: pointer;
height: 100%;
left: 0;
opacity: 0;
position: absolute;
width: 100%;
_noFocusLine: expression(this.hideFocus=true);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
-khtml-opacity: 0;
}
$(".fast-approval__select").each(function(){
$(this).wrap("<span class='select-wrapper'></span>");
$(this).after("<span class='select-wrapper__holder'></span>");
});
$(".fast-approval__select").change(function(){
var selectedOption = $(this).find(":selected").text();
$(this).next(".select-wrapper__holder").text(selectedOption);
}).trigger('change');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment