WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
[resolved] changing selected image in gallery redraws page and moves cursor (7 posts)

  1. efikim
    Member
    Posted 1 year ago #

    If you use the carousel style (and possibly any style other than slideshow) then when you switch to a new image the page is redrawn, and the view repositioned to the top of the page, not on the gallery display. OK if a short post, but not really acceptable on a page where the gallery is 'below the fold'

    demo: NextGen gallery test page on Holmes CHapel Camera Club blog

    (actually on WordPress 3.5 release candidate there, but also occurs on earlier releases)

    http://wordpress.org/extend/plugins/nextgen-gallery/

  2. smigliorato
    Member
    Posted 1 year ago #

    This seems to be a quirk of NextGen.

    I don't have time to do it right now (I have a family function I have to leave for a couple of minutes) but perhaps we can set a named anchor for the slideshow.

    It would look like this:

    // Current Code
    <div class="ngg-galleryoverview">
    
    // Change to:
    <div class="ngg-galleryoverview" id="slideshow">

    Then, we can modify the img links like so:

    // Current Code
    <a title=" " href="/test/nggtest/?pid=2">
    
    // Change to
    <a title=" " href="/test/nggtest/#slideshow?pid=2">

    That code is generated, so it would require hacking around in the php and/or javascript that creates the links.

    A bunch of NextGen stuff has this problem (even on the official site).

    When I get back later tonight (probably around 6-7 hours from now unfortunately) I will try to throw something together if someone else hasn't taken it up.

    Make sure your subscribed to the thread so you get an update when I do.

  3. efikim
    Member
    Posted 1 year ago #

    Thanks!

    Can I suggest a slight generalisation - that the tag includes both the name of the view ('slideshow') and also the identifier for the gallery, so it would work if two gallery presentations were shown (views fromn two galleries such as for example http://www.holmeschapelcameraclub.org.uk/manchester-christmas-markets-2012/ - one gallery for the participants and one for the photographs they'd taken), or possibly one showing the results of using two different presentations for the same gallery (though I can't think of a real reason for doing the latter at the moment)

    yes, I'm subscribed ;)

  4. smigliorato
    Member
    Posted 1 year ago #

    I first started looking at the NextGen PHP code to try and see if I could "fix it right," but it will probably be a bigger project to do that. In addition, any edits would get overwritten when NextGen updates.

    So, I thought of the simplest solution. I have 16 lines of javascript that should work on both of your pages. This should also work after an update.

    Facts:

    This will move the page down to the top of the gallery (or the bottom if there isn't enough room).

    On the two gallery page (or other pages with multiple galleries), it will only move to the first gallery. If that is a big issue, I can work something out.

    It kind of "jumps" to the location. I might be able to animate it, so its a smooth scroll, if that interests you.

    I wouldn't consider this a complete fix. That would involve the bigger edits I talked about in the first paragraph. But, this will work for now, and into the foreseeable future.

    I've made a complete plugin file:

    Download the zip

    You will have to save that file to your computer. Then go to Plugins->Add New. There, next to "Search", you can click "Upload."

    Select the downloaded zip and upload. Then, just activate it like a normal plugin. This is nice, because its easy to disable if you have any trouble (as opposed to having to paste in code yourself).

    I know its a quick fix, but I submitted it to the plugin repository. This way it will be super easy to install, and it will be able to use the auto-update mechanism.

    Please let me know if anything is wrong. I will update you accordingly if I make any changes.


    I made a temporary page here
    for the plugin. It has more contact options.

    I think I may have forgotten something, but it is almost 2:30am where I'm at. I need sleep.

  5. efikim
    Member
    Posted 1 year ago #

    Thanks! I'll try it out later today.

    Don't waste time trying to fix for multiple galleries on a page ... more than one gallery has bigger problems than having to scroll down on a refresh! I'll add another topic for that when I've done some testing of different scenarios.

  6. efikim
    Member
    Posted 1 year ago #

    Yes, works fine. Thankyou! :)

  7. smigliorato
    Member
    Posted 1 year ago #

    Awesome, glad to hear it. Let me know if you need anything else, or any additional functionality.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic