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

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

<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不到。android

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

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

若是你的<a>剛好沒給出href屬性,那麼好,safari就開始僞裝沒看到,僞裝<a>不存在。html的問題嘛,js裏也不會報錯。safari就是毛病多,mdzz。bootstrap

改爲這樣就行了:spa

<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>    
相關文章
相關標籤/搜索