Fix for page number with fancybox
It is far from perfect. Should be investigated by reading fancybox code if there's a better way later on
This commit is contained in:
parent
3469704e1b
commit
708d4de228
@ -38,7 +38,7 @@ jQuery(document).ready(function($)
|
|||||||
if (urlParams.get('page') != "")
|
if (urlParams.get('page') != "")
|
||||||
targetPage = urlParams.get('page');
|
targetPage = urlParams.get('page');
|
||||||
|
|
||||||
|
var currentPage = 0;
|
||||||
var previousArray = []
|
var previousArray = []
|
||||||
var options =
|
var options =
|
||||||
{
|
{
|
||||||
@ -48,9 +48,8 @@ jQuery(document).ready(function($)
|
|||||||
className: 'paginationjs-theme-blue',
|
className: 'paginationjs-theme-blue',
|
||||||
callback: function (response, pagination)
|
callback: function (response, pagination)
|
||||||
{
|
{
|
||||||
console.log(window.location.pathname);
|
currentPage = pagination.pageNumber;
|
||||||
console.log(window.location.hash);
|
window.history.replaceState('', '', window.location.pathname + '?page=' + currentPage + window.location.hash);
|
||||||
window.history.replaceState('', '', window.location.pathname + '?page=' + pagination.pageNumber + window.location.hash); // careful, back button is broken with that
|
|
||||||
|
|
||||||
if (previousArray.length > 0)
|
if (previousArray.length > 0)
|
||||||
{
|
{
|
||||||
@ -87,7 +86,6 @@ jQuery(document).ready(function($)
|
|||||||
mobile: {
|
mobile: {
|
||||||
preventCaptionOverlap: true,
|
preventCaptionOverlap: true,
|
||||||
},
|
},
|
||||||
hash: false,
|
|
||||||
|
|
||||||
caption: function(instance, item)
|
caption: function(instance, item)
|
||||||
{
|
{
|
||||||
@ -126,7 +124,12 @@ jQuery(document).ready(function($)
|
|||||||
$('#pagination').pagination('previous');
|
$('#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);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user