update hammer js

This commit is contained in:
r888888888
2014-08-14 15:05:11 -07:00
parent 8c52d2f376
commit 3fb0072dea
4 changed files with 47 additions and 22 deletions

View File

@@ -11,24 +11,25 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
<script type="text/javascript">
$(function() {
$(document).on("swipeleft", function(e) {
if (e.gesture.distance > 150) {
var href = $(".paginator a[rel=next]").attr("href");
if (href) {
window.location = href;
}
}
});
$(document).on("swiperight", function(e) {
if (e.gesture.distance > 150) {
var href = $(".paginator a[rel=prev]").attr("href");
if (href) {
window.location = href;
$(document)
.hammer()
.on("swipeleft", function(e) {
if (e.gesture.distance > 125) {
var href = $(".paginator a[rel=next]").attr("href");
if (href) {
window.location = href;
}
}
}
})
});
})
.on("swiperight", function(e) {
if (e.gesture.distance > 125) {
var href = $(".paginator a[rel=prev]").attr("href");
if (href) {
window.location = href;
}
}
});
})
</script>
<% end %>