一、touchmove事件只能觸發一次
解決:touchstart時阻止默認事件
二、HTML5畫布清除兩種方法
1、使用clearRect:
ctx.clearRect(0, 0, w, w)
2、使用重置畫布寬/高:
$canvas.attr("width", 0)
$canvas.attr("width", w)
三、localStorage本地存儲
//1. 獲取本地存儲對象
var storage = window.storage
//2. 添加鍵值對到本地存儲
storage.setItem("password", password)
//3. 從本地存儲獲取指定值
storage.getItem("password")
storage["password"]
//4. 存儲數組:由於localstorage只能存儲字符串格式,存數組前將其轉化爲JSON格式,取出時在解析爲數組
storage.setItem( "password", JSON.stringify(password) )
var localPw = storage.getItem("password") || []
localPw = JSON.parse( localPw )