View Full Version : Thumbnail over state
anothermethod
February 20th, 2007, 03:42 AM
Hello - I have question regarding thumbnail hovers...
I created a image gallery using PHP & SQL. I have thumbnails that swap out the main image and caption. What I'd like to do next is create a over state for the thumbnail but am a little confused about how I'd apply the javascript in the PHP loop.
Thanks in advanced!
Anothermethod.:alien:
borrob
February 20th, 2007, 06:44 AM
the output should be something like:
<img src="../img/normal.jpg" width="10" height="28" border="0" alt="" onMouseOver='src="../img/over.jpg"' onMouseOut='src="../img/normal.jpg"'>
Is this what you need?
anothermethod
February 20th, 2007, 01:29 PM
Yes, I think this is exactly what I need... Let me try it and post a working response.
Thanks for your help!!
anothermethod
February 20th, 2007, 06:17 PM
So I'm a little confused on where to put the onMouseOver, OnMouseOut...
Here's my php code I'm trying to add it to...
<tr>
<!--This row needs to be repeated-->
<?php
// initialize cell counter outside loop
$pos = 0;
do {
// set caption if thumbnail is same as main image
if ($row['filename'] == $mainImage) {
$caption = $row['caption'];
}
?>
<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?image=<?php echo $row['filename']; ?>"><img src="images/thumbs/<?php echo $row['filename']; ?>" alt="<?php echo $row['caption']; ?>" width="80" height="54" /></a></td>
<?php
$row = mysql_fetch_assoc($result);
// increment counter after next row extracted
$pos++;
// if at end of row and records remain, insert tags
if ($pos%COLS === 0 && is_array($row)) {
echo '</tr><tr>';
}
} while($row); // end of loop
// new loop to fill in final row
while ($pos%COLS) {
echo '<td> </td>';
$pos++;
}
?>
</tr>
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.