diff --git a/scripts/exposition.js b/scripts/exposition.js index 58dcfb1..95f3731 100644 --- a/scripts/exposition.js +++ b/scripts/exposition.js @@ -38,7 +38,7 @@ jQuery(document).ready(function($) if (urlParams.get('page') != "") targetPage = urlParams.get('page'); - + var currentPage = 0; var previousArray = [] var options = { @@ -48,9 +48,8 @@ jQuery(document).ready(function($) className: 'paginationjs-theme-blue', callback: function (response, pagination) { - console.log(window.location.pathname); - console.log(window.location.hash); - window.history.replaceState('', '', window.location.pathname + '?page=' + pagination.pageNumber + window.location.hash); // careful, back button is broken with that + currentPage = pagination.pageNumber; + window.history.replaceState('', '', window.location.pathname + '?page=' + currentPage + window.location.hash); if (previousArray.length > 0) { @@ -87,7 +86,6 @@ jQuery(document).ready(function($) mobile: { preventCaptionOverlap: true, }, - hash: false, caption: function(instance, item) { @@ -126,7 +124,12 @@ jQuery(document).ready(function($) $('#pagination').pagination('previous'); }, - + afterClose : function(instance) + { + // after closing, changing the URL again. I guess there's no better way except by changing fancybox code... + // (apparently fancybox changes back to the original url it had when starting) + window.history.replaceState('', '', window.location.pathname + '?page=' + currentPage + window.location.hash); + } }); });