From 558a80eb961be9021aebe22d9f86f4d5e48baef7 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 24 Jul 2018 17:36:11 +0200 Subject: [PATCH] fix #1948 @0.25 --- js/libs/fluidbook/fluidbook.js | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index 42dcda63..6aa245ec 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -608,30 +608,35 @@ Fluidbook.prototype = { speed = 0; } + var max = this.getMaxPage() % 2 == 1 ? this.getMaxPage() - 1 : this.getMaxPage(); + var next = page < max; + var previous = (page > 1); + if (Modernizr.csstransitions) { - if (page <= 1) { - $("#previous").addClass('hidden'); + if (next) { + $("#next").removeClass('hidden'); } else { - $("#previous").removeClass('hidden'); + $("#next").addClass('hidden'); } - if (page >= this.getMaxPage()) { - $("#next").addClass('hidden'); + if (previous) { + $("#previous").removeClass('hidden'); } else { - $("#next").removeClass('hidden'); + $("#previous").addClass('hidden'); } } else { $("#previous,#next").removeClass('hidden'); - if (page <= 1) { - $("#previous:visible").fadeOut(speed); - } else { + + if (previous) { $("#previous:hidden").fadeIn(speed); + } else { + $("#previous:visible").fadeOut(speed); } - if (page >= this.getMaxPage()) { - $("#next:visible").fadeOut(speed); - } else { + if (next) { $("#next:hidden").fadeIn(speed); + } else { + $("#next:visible").fadeOut(speed); } } }, -- 2.39.5