improve swiping logic
This commit is contained in:
@@ -9,12 +9,12 @@ body {
|
||||
}
|
||||
|
||||
input[type=text], input[type=submit] {
|
||||
font-size: 20pt;
|
||||
font-size: 18pt;
|
||||
}
|
||||
|
||||
/* paginator */
|
||||
div.paginator {
|
||||
font-size: 18pt;
|
||||
font-size: 16pt;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
|
||||
|
||||
@@ -11,17 +11,21 @@
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$(document).on("swipeleft", function() {
|
||||
var href = $(".paginator a[rel=next]").attr("href");
|
||||
if (href) {
|
||||
window.location = href;
|
||||
$(document).on("swipeleft", function(e) {
|
||||
if (e.gesture.distance > 240) {
|
||||
var href = $(".paginator a[rel=next]").attr("href");
|
||||
if (href) {
|
||||
window.location = href;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("swiperight", function() {
|
||||
var href = $(".paginator a[rel=prev]").attr("href");
|
||||
if (href) {
|
||||
window.location = href;
|
||||
$(document).on("swiperight", function(e) {
|
||||
if (e.gesture.distance > 240) {
|
||||
var href = $(".paginator a[rel=prev]").attr("href");
|
||||
if (href) {
|
||||
window.location = href;
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
@@ -13,15 +13,19 @@
|
||||
<meta name="viewport" content="width=device-width,initial-scale=<%= @post.device_scale %>">
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$(document).on("swipeleft", function() {
|
||||
var href = $(".paginator a[rel=next]").attr("href");
|
||||
if (href) {
|
||||
window.location = href;
|
||||
$(document).on("swipeleft", function(e) {
|
||||
if (e.gesture.distance > 240) {
|
||||
var href = $(".paginator a[rel=next]").attr("href");
|
||||
if (href) {
|
||||
window.location = href;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("swiperight", function() {
|
||||
window.history.back();
|
||||
$(document).on("swiperight", function(e) {
|
||||
if (e.gesture.distance > 240) {
|
||||
window.history.back();
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user