亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

移動端js如何組織瀏覽器左右快速滑動會切換tab的問題

移動端js如何組織瀏覽器左右快速滑動會切換tab的問題

慕斯709654 2018-09-04 10:09:34
移動端在做左右滑動效果的時候, 已經e.preventDefault 和 e.stopPropagation 了, 但是當快速左右滑動的時候 還是會出現 滑到上一個選項卡和下一個選項卡的 現象, 請問能否阻止 這個動作剛發現只要手指點到屏幕邊緣 就會觸發切換標簽的動作,document.body上也加preventDafult了, 仍然會觸發, 如何阻止這個動作function handleStart(e) {    stopDefault(e);    ...}function handleMove(e) {    stopDefault(e);    ...}function handleEnd(e) {    stopDefault(e);    ...}function stopDefault(e) {    e.stopPropagation();    e.preventDefault();}...document.addEventListener("touchstart", stopDefault, false)document.addEventListener("touchmove", stopDefault, false);document.addEventListener("touchend", stopDefault, false);...tab.addEventListener("touchend", handleEnd, false);tab.addEventListener("touchmove", handleMove, false);tab.addEventListener("touchstart", handleStart, false);
查看完整描述

1 回答

?
皈依舞

TA貢獻1851條經驗 獲得超3個贊

是在哪個事件下面阻止的默認事件?
試試給document綁定touchmove事件,然后阻止默認事件。

查看完整回答
反對 回復 2018-10-10
  • 1 回答
  • 0 關注
  • 922 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號