Commit 5d3b14fd by doszhang

dos

parent 0da853e7
......@@ -75,6 +75,41 @@ $(document).ready(function () {
$('.answer').on('click', chooseAnswer);
//下一题
$('.btn-nextquestion').on('click', nextQuestion);
$(".index-block").on("touchstart", function (e) {
// 判断默认行为是否可以被禁用
if (e.cancelable) {
// 判断默认行为是否已经被禁用
if (!e.defaultPrevented) {
e.preventDefault();
}
}
startX = e.originalEvent.changedTouches[0].pageX,
startY = e.originalEvent.changedTouches[0].pageY;
});
$(".index-block").on("touchend", function (e) {
// 判断默认行为是否可以被禁用
if (e.cancelable) {
// 判断默认行为是否已经被禁用
if (!e.defaultPrevented) {
e.preventDefault();
}
}
moveEndX = e.originalEvent.changedTouches[0].pageX,
moveEndY = e.originalEvent.changedTouches[0].pageY,
X = moveEndX - startX,
Y = moveEndY - startY;
//左滑
if (X > 0) {
console.log('左滑');
}
//右滑
else if (X < 0) {
console.log('右滑');
}
});
});
function nextQuestion() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment