add gesture support for mobile page
This commit is contained in:
7
app/assets/javascripts/mobile.js
Normal file
7
app/assets/javascripts/mobile.js
Normal file
@@ -0,0 +1,7 @@
|
||||
//= require jquery-1.10.1.min.js
|
||||
//= require hammer.min.js
|
||||
//= require jquery.hammer.min.js
|
||||
|
||||
$(function() {
|
||||
$(document).hammer();
|
||||
});
|
||||
@@ -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 %>
|
||||
|
||||
@@ -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 %>
|
||||
|
||||
Reference in New Issue
Block a user