我试图在实习期间为移动应用实施简单的滑动。在我将它实现到我的项目之前,我首先做了一个例子。当我向左滑动时,我将被重定向到下一页。但是,当我尝试向右滑动以返回上一页时,我需要大约4次尝试才能返回。
的index.html
*{
padding: 0;
margin: 0;
}
div{
max-width: 1024px;
width: 100%;
height: 768px;
background: green;
}
<div></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4
/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5
/jquery.mobile.min.js"></script>
<script>
$("div").on("swipeleft",function(){
window.location = "nextpage.html";
});
});
</script>
nextpage.html
*{
padding: 0;
margin: 0;
}
div{
max-width: 1024px;
width: 100%;
height: 768px;
background: blue;
}
<div></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4
/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5
/jquery.mobile.min.js"></script>
<script>
$("div").on("swiperight",function(){
window.location = "index.html";
});
});
</script>