revert hammer js changes

This commit is contained in:
r888888888
2014-08-20 16:49:20 -07:00
parent f0ab7ae937
commit 81c5c15758
39 changed files with 49 additions and 52 deletions

View File

@@ -11,20 +11,23 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
<script type="text/javascript">
$(function() {
var doc = new Hammer(document.body);
doc.on("swipeleft", function(e) {
var href = $(".paginator a[rel=next]").attr("href");
if (href) {
window.location = href;
}
});
doc.on("swiperight", function(e) {
var href = $(".paginator a[rel=prev]").attr("href");
if (href) {
window.location = href;
$(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;
}
}
})
});
</script>
<% end %>

View File

@@ -13,17 +13,19 @@
<meta name="viewport" content="width=device-width,initial-scale=<%= @post.device_scale %>">
<script type="text/javascript">
$(function() {
var doc = new Hammer(document.body);
doc.on("swipeleft", function(e) {
var href = $(".paginator a[rel=next]").attr("href");
if (href) {
window.location = href;
$(document).on("swipeleft", function(e) {
if (e.gesture.distance > 150) {
var href = $(".paginator a[rel=next]").attr("href");
if (href) {
window.location = href;
}
}
});
doc.on("swiperight", function(e) {
window.history.back();
$(document).on("swiperight", function(e) {
if (e.gesture.distance > 150) {
window.history.back();
}
})
});
</script>