微信小程序--在canvas畫布上划動,頁面禁止滑動


要實現微信小程序 在canvas畫布上划動,頁面禁止滑動,不僅要設置disable-scroll="true",還要要給canvas綁定一個觸摸事件才能生效。

<canvas canvas-id="myCanvas" class="myCanvas"  disable-scroll="false" bindtouchstart="touchStart" bindtouchmove="touchMove" bindtouchend="touchEnd">
</canvas>

 

關於canvas觸摸事件,在canvas上一定要綁定三個觸摸事件,真機才能響應到畫布觸摸的event。bindtouchstart/bindtouchmove/bindtouchend,只綁定兩個或一個會導致真機獲取不到canvas上的觸摸事件。

 


免責聲明!

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



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