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:
		@@ -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);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            });
 | 
			
		||||
    });
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user