Vue橫向滾動鼠標控制


let level_cards
  // 標記可移動
  , move_start
  // 移動初始的x位置
  , move_x
  // 移動初始的容器偏移量
  , move_scroll_left
  // 判斷是否為移動, 是則取消原來的點擊
  , moved

startMove(e) {
  // console.log(e)
  move_start = true
  move_x = e.clientX
  move_scroll_left = level_cards.scrollLeft
},
move(e) {
  if(move_start) {
    // 位移大於10像素認為是移動
    if(move_x - e.clientX > 10) {
      moved = true
    }
    level_cards.scrollLeft = move_scroll_left + move_x - e.clientX
  }
},
endMove(e) {
  e.stopPropagation()
  move_start = false
},


免責聲明!

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



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