javascript - replacing <select> aroow with a custom image and make it open dropdown -
i have drop down in page. disabled default arrow comes select , on layed custom arrow ( icon font). issue facing when click on custom arrow, drop down doesn't open up. there way working.
html mark up:
<span class="drop-down-arrow"></span> <select name="" id="subject" class="applicationdropdown"> <option value="option 1">o[tion 1</option> <option value="o[tion 2">o[tion 2</option> <option value="other">other</option> </select>
css code:
select{ -webkit-appearance: none; -moz-appearance: none; } .applicationdropdown{ background:#e6e6e6; color:#989898; @include rem-px(font-size,(16px)); @include rem-px(height,(50px)); max-height:200px; overflow-y:scroll; outline : none; transition: none; } span.drop-down-arrow{ background: #a4cf53; display: block; float: right; @include rem-px(height,(50px)); @include rem-px(width,(40px)); position:relative; @include rem-px(right,(1px)); @include rem-px(top,(50px)); &:after{ clear: both; content: "\e669"; color:#fff; font-family:icons; @include rem-px(font-size,(13px)); display: block; float: right; height: 0; position: relative; @include rem-px(right,(7px)); @include rem-px(top,(21px)); } }
you can use 'pointer-events:none;' css property in arrow(please check browser copatibility bellow ie8)
eg:
<div class="wrapper"> <span class="drop-down-arrow"></span> <select name="" id="subject" class="applicationdropdown"> <option value="option 1">o[tion 1</option> <option value="o[tion 2">o[tion 2</option> <option value="other">other</option> </select> </div>
css:
.wrapper{ position:relative; float:left; } select{ -webkit-appearance: none; -moz-appearance: none; } .applicationdropdown{ background:#e6e6e6; color:#989898; @include rem-px(font-size,(16px)); @include rem-px(height,(50px)); max-height:200px; overflow-y:scroll; outline : none; transition: none; } span.drop-down-arrow{ background: #a4cf53; display: block; position:absolute; width:20px; height:20px; pointer-events:none; right:0; top:0; z-index:999; }
Comments
Post a Comment