WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Next Gen image browser jump to top of page effect (5 posts)

  1. webbrewers
    Member
    Posted 2 years ago #

    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?

  2. webbrewers
    Member
    Posted 2 years ago #

    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

  3. webbrewers
    Member
    Posted 2 years ago #

    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>

  4. webbrewers
    Member
    Posted 2 years ago #

  5. HighHopes
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.