tweak gesture js
This commit is contained in:
@@ -47,35 +47,26 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var hasNext = $("a[rel~=next]").length > 0;
|
||||
var hasPrev = $("a[rel~=prev]").length > 0;
|
||||
$("body").hammer().bind("pan", function(e) {
|
||||
var percentage = 100 * e.gesture.deltaX / window.innerWidth;
|
||||
if (percentage < -10) {
|
||||
$("body").css({"transition-duration": "0.1s", "transform": "translateX(" + percentage + "%)"});
|
||||
} else if (percentage > 10) {
|
||||
$("body").css({"transition-duration": "0.1s", "transform": "translateX(" + percentage + "%)"});
|
||||
}
|
||||
});
|
||||
|
||||
if (hasNext) {
|
||||
$("body").hammer().bind("panleft", function(e) {
|
||||
var percentage = 100 * e.gesture.deltaX / window.innerWidth;
|
||||
if (percentage < -10) {
|
||||
$("body").css({"transition-duration": "0.1s", "transform": "translateX(" + percentage + "%)"});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (hasPrev) {
|
||||
$("body").hammer().bind("panright", function(e) {
|
||||
var percentage = 100 * e.gesture.deltaX / window.innerWidth;
|
||||
if (percentage > 10) {
|
||||
$("body").css({"transition-duration": "0.1s", "transform": "translateX(" + percentage + "%)"});
|
||||
}
|
||||
});
|
||||
}
|
||||
var hasNext = $(".paginator a[rel~=next]").length > 0;
|
||||
var hasPrev = $("#a-show").length || $(".paginator a[rel~=prev]").length > 0;
|
||||
|
||||
$("body").hammer().bind("panend", function(e) {
|
||||
var percentage = e.gesture.deltaX / window.innerWidth;
|
||||
if (hasPrev && percentage > 0.3) {
|
||||
$("body").css({"transition-timing-function": "ease", "transition-duration": "0.3s", "opacity": "0", "transform": "translateX(150%)"});
|
||||
Danbooru.Post.nav_prev(e);
|
||||
$("body").css({"transition-timing-function": "linear", "transition-duration": "0.3s", "opacity": "0", "transform": "translateX(150%)"});
|
||||
$.timeout(250).done(function() {Danbooru.Post.nav_prev(e)});
|
||||
} else if (hasNext && percentage < -0.3) {
|
||||
$("body").css({"transition-timing-function": "ease", "transition-duration": "0.3s", "opacity": "0", "transform": "translateX(-150%)"});
|
||||
Danbooru.Post.nav_next(e);
|
||||
$("body").css({"transition-timing-function": "linear", "transition-duration": "0.3s", "opacity": "0", "transform": "translateX(-150%)"});
|
||||
$.timeout(250).done(function() {Danbooru.Post.nav_next(e)});
|
||||
} else {
|
||||
$("body").css({"transition-timing-function": "ease", "transition-duration": "0.5s", "transform": "none"});
|
||||
}
|
||||
@@ -198,8 +189,8 @@
|
||||
if ($("#search-seq-nav").length) {
|
||||
var href = $("#search-seq-nav a[rel~=next]").attr("href");
|
||||
location.href = href;
|
||||
} else if ($("a[rel~=next]").length) {
|
||||
location.href = $("a[rel~=next]").attr("href");
|
||||
} else if ($(".paginator a[rel~=next]").length) {
|
||||
location.href = $(".paginator a[rel~=next]").attr("href");
|
||||
} else {
|
||||
var href = $("#pool-nav a.active[rel~=next], #favgroup-nav a.active[rel~=next]").attr("href");
|
||||
if (href) {
|
||||
|
||||
Reference in New Issue
Block a user