Jump to content

Photo gallery positioning


VoodooJai

Recommended Posts

Hi all happy New Year

I have a page with a photo gallery in the middle of the page. This uses PHP to display the images one at a time but every time it loads a new image the page returns to the top.

I want to use navigation bar as an anchor to re load the page so that the gallery preview is set to show without having to scroll down to see it.

 

Many thanks Jai

Link to comment
https://forums.phpfreaks.com/topic/186938-photo-gallery-positioning/
Share on other sites

window.location.hash = 'gallery-id';

Thanks for the help this sort of works, I used it as an onclick event in the href tag of an anchor.

 

It does reposition the window but when the new data (image) is loaded it goes back to the top of the page.

I think it needs to come second in the events. How would I do this.

 

Jai

this is the code for the nav bar a DW8 extract is this enough details

 

<table border="0" width="50%" align="center">
              <tr>
                <td width="23%" align="center"><?php if ($pageNum_Display400pxPhoto > 0) { // Show if not first page ?>
                      <a href="<?php printf("%s?pageNum_Display400pxPhoto=%d%s", $currentPage, 0, $queryString_Display400pxPhoto); ?>">First</a>
                      <?php } // Show if not first page ?>
                </td>
                <td width="31%" align="center"><?php if ($pageNum_Display400pxPhoto > 0) { // Show if not first page ?>
                      <a href="<?php printf("%s?pageNum_Display400pxPhoto=%d%s", $currentPage, max(0, $pageNum_Display400pxPhoto - 1), $queryString_Display400pxPhoto); ?>">Previous</a>
                      <?php } // Show if not first page ?>
                </td>
                <td width="23%" align="center"><?php if ($pageNum_Display400pxPhoto < $totalPages_Display400pxPhoto) { // Show if not last page ?>
                      <a href="<?php printf("%s?pageNum_Display400pxPhoto=%d%s", $currentPage, min($totalPages_Display400pxPhoto, $pageNum_Display400pxPhoto + 1), $queryString_Display400pxPhoto); ?>" onclick="window.location.hash = 'gallery-id';">Next</a>
                      <?php } // Show if not last page ?>
                </td>
                <td width="23%" align="center"><?php if ($pageNum_Display400pxPhoto < $totalPages_Display400pxPhoto) { // Show if not last page ?>
                      <a href="<?php printf("%s?pageNum_Display400pxPhoto=%d%s", $currentPage, $totalPages_Display400pxPhoto, $queryString_Display400pxPhoto); ?>">Last</a>
                      <?php } // Show if not last page ?>
                </td>
              </tr>
            </table>

 

Jai

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.