VoodooJai Posted January 2, 2010 Share Posted January 2, 2010 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 Quote Link to comment Share on other sites More sharing options...
ignace Posted January 2, 2010 Share Posted January 2, 2010 window.location.hash = 'gallery-id'; Quote Link to comment Share on other sites More sharing options...
VoodooJai Posted January 2, 2010 Author Share Posted January 2, 2010 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 Quote Link to comment Share on other sites More sharing options...
ignace Posted January 2, 2010 Share Posted January 2, 2010 How would I do this. You may want to try posting your code Quote Link to comment Share on other sites More sharing options...
VoodooJai Posted January 2, 2010 Author Share Posted January 2, 2010 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.