add gesture support for mobile page

This commit is contained in:
r888888888
2014-04-12 14:48:16 -07:00
parent 8895759ea1
commit 08da53f7f0
5 changed files with 65 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
//= require jquery-1.10.1.min.js
//= require hammer.min.js
//= require jquery.hammer.min.js
$(function() {
$(document).hammer();
});

View File

@@ -9,4 +9,27 @@
<%= content_for(:html_header) do %>
<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("swiperight", function() {
var href = $(".paginator a[rel=prev]").attr("href");
if (href) {
window.location = href;
}
})
});
</script>
<% end %>
<% if @post_set.tag_string.present? %>
<%= @post_set.humanized_tag_string %> - <%= Danbooru.config.app_name %>
<% else %>
<%= Danbooru.config.app_name %>
<% end %>

View File

@@ -11,4 +11,22 @@
<%= content_for(:html_header) do %>
<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("swiperight", function() {
window.history.back();
})
});
</script>
<% end %>
<% content_for(:page_title) do %>
<%= @post.presenter.humanized_essential_tag_string %> - <%= Danbooru.config.app_name %>
<% end %>