fastclick:處理移動端click事件300毫秒延遲

來源:互聯網
上載者:User

標籤:string   移動   class   str   code   port   cli   縮放   相容性   

fastclick:處理移動端click事件300毫秒延遲

1、相容性
  • iOS 3及更高版本的移動Safari
  • iOS 5及更高版本的Chrome
  • Android上的Chrome(ICS)
  • Opera Mobile 11.5及以上版本
  • Android 2以來的Android瀏覽器
  • PlayBook OS 1及以上版本
2、不應用FastClick的情境

案頭瀏覽器; 
如果視口元標籤中設定了width=device-width,Android上的Chrome 32+會禁用300ms延時;

<meta name="viewport" content="width=device-width, initial-scale=1">
  • 1

視頻元標籤如果設定了user-scalable=no,Android上的Chrome(所有版本)都會禁用300ms延遲。 
IE10中,可以使用css屬性-ms-touch-action: none禁止元素雙擊縮放(參考文章)。

3、安裝:

先執行安裝fastclick的命令。

npm install fastclick -S

之後,在main.js中引入,並綁定到body

import FastClick from ‘fastclick‘FastClick.attach(document.body);

fastclick:處理移動端click事件300毫秒延遲

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.