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

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

js event.offfsetX無法通過touchstart事件獲???

js event.offfsetX無法通過touchstart事件獲取?

縹緲止盈 2018-09-04 09:22:09
*{padding:0;margin:0;} .progress{width:200px;height:20px;background:yellow;position:relative;} .progress-wrap{width:180px;height:100%;position:relative;} .progress-bar{width:20px;height:20px;position:absolute;background:red;} <div class="progress">     <div class="progress-wrap">       <div class="progress-bar"></div>     </div>   </div> $(".progress").on("touchstart", function(e) {   alert(e.offsetX); });我想獲取到當點擊.progress-bar時他相對于.progress的距離,但是不知道為什么怎么都獲取不到不只是什么原因?demo在這里 http://codepen.io/anon/pen/Ob..
查看完整描述

1 回答

?
海綿寶寶撒

TA貢獻1809條經驗 獲得超8個贊

e.originalEvent.touches[0]
touch的好像還有一個可以獲取觸摸位置的。我忘了。

https://img1.sycdn.imooc.com//5bd3d5cf000118a103090739.jpg


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

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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