WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Next Gen image browser jump to top of page effect

[Resolved] Next Gen image browser jump to top of page effect

  • webbrewers
    Member

    @webbrewers

    The image browser navigation reloads the page. I’ve tried all the fixes I could find (modifying shutter-reloaded.js) but none have worked.
    Has anyone really fixed this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • webbrewers
    Member

    @webbrewers

    Found a simple solution. It suggests using a span with an id before the next/previous links and then adding a hash tag, but an anchor tag works equally well.

    http://wordpress.org/support/topic/plugin-nextgen-gallery-image-browser-customisation-page-reload?replies=9

    webbrewers
    Member

    @webbrewers

    I modified the above a bit to allow for multiple image browsers on a page. Instead of adding a static hash tag, I used the <?php echo $image->anchor ?> tag to dynamically generate an anchor.
    So in imagebrowser.php add this before the gallery title:
    <a name="<?php echo $image->anchor ?>"/>
    And format the next/previous links like this:
    <a class="ngg-browser-prev" id="ngg-prev-<?php echo $image->previous_pid ?>" href="<?php echo $image->previous_image_link ?>#<?php echo $image->anchor ?>">◄ <?php _e('Back', 'nggallery') ?></a>

    webbrewers
    Member

    @webbrewers

    HighHopes
    Member

    @highhopes

    wow.. that actually worked! you are a code-wizard.

    i don’t like how the imagebrowser defaults to jump to the top of the page because my gallery is not at the top of the page!

    here are the full instructions:
    1. in the nextgen plugin folder, open the file imagebrowser.php

    2. find this line:
    <div class="ngg-imagebrowser" id="<?php echo $image->anchor ?>">

    and just above that line, add this text:
    <a name="<?php echo $image->anchor ?>"/>

    3. find this line:
    </a><a>previous_pid ?>" href="<?php echo $image->previous_image_link ?>">◄ <?php _e('Back', 'nggallery') ?></a>

    and replace it with this line:
    <a>previous_pid ?>" href="<?php echo $image->previous_image_link ?>#<?php echo $image->anchor ?>">◄ <?php _e('Back', 'nggallery') ?></a>

    4. find this line:
    <a>next_pid ?>" href="<?php echo $image->next_image_link ?>"><?php _e('Next', 'nggallery') ?> ►</a>

    and replace it with this line:
    <a>next_pid ?>" href="<?php echo $image->next_image_link ?>#<?php echo $image->anchor ?>"> <?php _e('Next', 'nggallery') ?> ►</a>

    thx to webbrewers for the original work.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Next Gen image browser jump to top of page effect’ is closed to new replies.