css - How to add a hover effect on a dropdown? -
i'm designing new website , added dropdown works fine when clicked. want show dropdown when hovered.
what tried was:
{% include 'currency-picker' %} <style> .currency-picker { background-color: transparent; font-size: 12pt; font:montserrat; letter-spacing: 2px; color: black; } .currency-picker:hover { display: block; } .currency-picker:hover { background-color: white;
this dropdown itself:
<label class="currency-picker__wrapper"> <span class="currency-picker__label"></span> <select class="currency-picker" name="currencies" style="display: inline; width: auto; vertical-align: inherit;"> {% assign codes = 'usd,eur,gbp,cad,ars,aud,bbd,bdt,bsd,bhd,brl,bob,bnd,bgn,ils,mmk,kyd,clp,cny,cop,crc,hrk,czk,dkk,dop,xcd,egp,xpf,fjd,ghs,gtq,gyd,gel,hkd,huf,isk,inr,idr,nis,jmd,jpy,jod,kzt,kes,kwd,lvl,ltl,mxn,myr,mur,mdl,mad,mnt,mzn,ang,nzd,ngn,nok,omr,pkr,pyg,pen,php,pln,qar,ron,rub,sar,rsd,scr,sgd,syp,zar,krw,lkr,sek,chf,twd,thb,tzs,ttd,try,uah,aed,uyu,veb,vnd,zmk' | split: ',' %} {% assign supported_codes = settings.supported_currencies | split: ' ' %} <option value="{{ shop.currency }}" selected="selected">{{ shop.currency }}</option> {% code in supported_codes %} {% if code != shop.currency , codes contains code %} <option value="{{ code }}">{{ code }}</option> {% endif %} {% endfor %} </select> </label>
the strange thing is, .currency-picker:hover { background-color: white; works , indeed show white background when hovered.
is there knowing solutions of problem?
have nice day , best regards,
ismael
after looking @ code, there reason why don't use same markup other dropdowns? consistency key.
what trying not work or not allowed in browser. instead of using actual "select" box, use actual markup using on other dropdowns give exact functionality looking for.
this code (taken site) should give clue on how handle this. ave starting script tag on page dropped new test code..
please note changed below code bit give better reference. if drop code site, work, need refactor make dynamic.
<li class="site-nav__item site-nav__expanded-item site-nav--has-dropdown" aria-haspopup="true"> <a href="/collections/for-her" class="site-nav__link">usd <span class="icon icon-arrow-down" aria-hidden="true"></span></a> <ul class="site-nav__dropdown text-left"> <li> <a href="/collections/bags" class="site-nav__dropdown-link">eur</a> </li> <li> <a href="/collections/high-heels" class="site-nav__dropdown-link">chf</a> </li> </ul>
Comments
Post a Comment