...

View Full Version : Remembering scrollbar position



melissadiane
06-29-2009, 12:17 AM
Hello everyone,

I have a gallery for a client located at http://www.permacastwalls.com/gallery2.php.

The client is unhappy that the scrollbar on the filmstrip at the top "pops" back to the beginning when a new picture is loaded. I can see his point, but I'm not sure how to fix this. Right now, it's written in PHP. I know only a little Javascript. Here is the relevent code:



<div id="gallery">

<?php

$thumb_dir = "images/thumb/";
$mid_dir = "images/mid/";
$full_dir = "images/full/";

$con = ... or die('Could not connect to server');
mysql_select_db("permacast_photos", $con) or die('Could not retrieve photos');

$query = "SELECT * FROM photos";
$result = mysql_query($query);

$num = 1;
echo '<div id="thumb_strip">';
while ($row = mysql_fetch_array($result)) {
echo '<span class="thumb">';
echo '<a href="gallery2.php?picture=' . $row["Title"];
echo '&num=' . $num;
echo '"><img src="';
echo $thumb_dir . $row["Filename"];
echo '" /></a></span>';
$num++;
}
echo '</div>';

echo '<div style="height: 130px"><!-- --></div>';

echo '<div id="main_image">';

if (!isset($_REQUEST['picture'])) {
echo '<p>Choose a picture from above.</p>';
} else {
$picture_title = $_REQUEST['picture'];
$picture_num = $_REQUEST['num'];

$query = "SELECT * FROM photos WHERE Title='$picture_title'";
$result = mysql_query($query); // or die( mysql_error());
$row = mysql_fetch_array($result);
$filename = $row["Filename"];

echo '<a href="picdisplay.php?filename=' . $full_dir . $filename . '">';
echo '<img src="' . $mid_dir . $filename . '" /></a><br />';
echo '<p>#' . $picture_num . ': ' . $row["Caption"] . ' <span class="click_here">Click to enlarge image.</span></p>';
}

echo '</div>';

?>


</div> <!-- end gallery -->


I'd really appreciate any help or suggestions with this.

-Melissa

mlseim
06-29-2009, 04:12 AM
You might find some solutions here:

http://www.google.com/search?q=javascript+remember+browser+vertical+scroll+position&btnG=Search

_Aerospace_Eng_
06-29-2009, 03:00 PM
Also you may want to remove any sensitive information in your post.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum