關於bootstrap的dropdown效果在ios safari中無效的問題


又來了一個困擾了我半小時的問題,這段bootstrap的html代碼在PC、在android的chrome上都跑的好好的,然而在IOS中就是不行。點了和沒點一樣,不會彈出dropdown。

<div class="dropdown">
    <a data-toggle="dropdown"><span class="glyphicon glyphicon-option-horizontal"></span></a>
    <ul class="dropdown-menu dropdown-menu-right" data-thumb-target="temp">
        <li><a href="#" class="thumb-up"></a></li>
        <li><a href="#" class="wonder"></a></li>
        <li><a href="#" class="thumb-down"></a></li>
    </ul>
</div>    

這么簡單的一段代碼,照着bootstrap的文檔寫的,在ios里就是彈不出來。沒有報錯沒有提示,try catch也catch不到。

后來搜着搜着搜到了stackoverflow上才找到了答案。

<a>在IOS上不能沒有href屬性!不能沒有href!不能沒有href!

如果你的<a>恰好沒給出href屬性,那么好,safari就開始假裝沒看到,假裝<a>不存在。html的問題嘛,js里也不會報錯。safari就是毛病多,mdzz。

改成這樣就好了:

<div class="dropdown">
    <a data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-option-horizontal"></span></a>
    <ul class="dropdown-menu dropdown-menu-right" data-thumb-target="temp">
        <li><a href="#" class="thumb-up"></a></li>
        <li><a href="#" class="wonder"></a></li>
        <li><a href="#" class="thumb-down"></a></li>
    </ul>
</div>    

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM