Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With pagination enabled, it always back to page 1 when closing an album #22

Open
marhensa opened this issue Jan 26, 2019 · 1 comment
Open

Comments

@marhensa
Copy link

Hi, first of all, thank you for this amazing work. It's really great!
I'm here just like to give a some suggestion.

From user standpoint it's frustating when we open an album, browsing it and then close it, it always back to page one (pagination enabled). Maybe it should be better if it remembers which page the last album located in pagination mode.

@bhartvigsen
Copy link

bhartvigsen commented Feb 7, 2019

I did a similar thing to allow the user to return to their original page after clearing search. Perhaps you can use this method to do what you want. At the top of the script I added:

var nanogalleryCurrentPage;
var G;

And then in ManagePagination() add a line to store the current page (nanoGalleryCurrentPage):

    var elt$ = jQuery('<div id="galleryPage-' + i + '" class="' + c + '">' + p + '</div>').appendTo(G.$E.conTnBottom);
    elt$.data('pageNumber', i );
    elt$.click( function(e) {
      nanogalleryCurrentPage = jQuery(this).data('pageNumber');
      G.GOM.pagination.currentPage = jQuery(this).data('pageNumber');
      TriggerCustomEvent('pageChanged');
      GalleryDisplayPart1( true );
      GalleryDisplayPart2( true );
    });

G.GOM.pagination.currentPage = ; will allow you to set the page.

You'll have to do a little dev work, this isn't a complete guide it's just what I (kinda) remember from implementing a similar thing. The key thing is storing the user's page in the ManagePagination() method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants