楼主
币种两种展示方式
<!-- 方法1: --> <div class="currency_box"> <div class="currency_txt" id='currencyBox'> <select> {notempty name="currency.code"} {empty name="currencies"} {else /} {volist name="currencies" id="vo"} <option value="?currency={$key}" data_1="{$key}" data_2="{$currency.code}">{$key}</option> {/volist} {/empty} {/notempty} </select> <svg t="1599188989711" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2357"><path d="M0 256l512 512 512-512z" p-id="2358"></path></svg> </div> <script> var pselect = document.querySelector('#currencyBox select'); pselect.onchange = function(){ window.location=this.value; } $('#currencyBox option').each(function(index, element) { var data1 = $(this).attr('data_1'); var data2 = $(this).attr('data_2'); if(data1 == data2){ $(this).attr('selected','selected'); } }); </script> </div> <!-- 方法2: --> <div class="currency_box"> <div class="currency_txt" id='currencyBox'>{notempty name="currency.code"}{$currency.code}{/notempty}<svg t="1603420911498" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="17635"><path d="M163.446154 275.692308h697.107692c19.692308 0 33.476923 25.6 17.723077 43.323077L537.6 736.492308c-11.815385 15.753846-37.415385 15.753846-49.230769 0L143.753846 319.015385c-13.784615-17.723077-1.969231-43.323077 19.692308-43.323077z" p-id="17636"></path></svg></div> <div class="drop_currency" id='currencyCon'> <ul class="currency"> {empty name="currencies"} {else /} {volist name="currencies" id="vo"} <li> <a rel="nofollow" href="?currency={$key}"> <span>{$key}</span> </a> </li> {/volist} {/empty} </ul> </div> <script> $("#currencyBox").click(function(e){ if($("#currencyCon").hasClass('drop_currency_on')){ $("#currencyCon").removeClass('drop_currency_on'); }else{ $("#currencyCon").addClass('drop_currency_on'); } e.stopPropagation(); }); $('.drop_currency').click(function(e){ e.stopPropagation(); }); $(document).click(function(){ $("#currencyCon").removeClass('drop_currency_on'); }); </script> </div>
本文内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件至:admin@ptpc120.com 进行举报,并提供相关证据,工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。
请登录后评论~