Hi, I'm not going to worry about the top fading images for now.. but I just want to get the featured product area working.(the one with NEXT and PREV buttons).
I'll post the javascript for that as it was located in 'slide.js':
Code:
// Cross-browser cleanup by Paul Anderson, CNET Builder.com. All rights reserved.
var numSlides = 4;
var currentSlide = numSlides;
function setUp() {
if (!document.all) {
document.all = document;
for (i=1;i<=numSlides;i++) document.all[("image"+i)].style=document.all[("image"+i)];
}
switchSlide(1);
}
function switchToSlide(sDir) {
newSlide = sDir;
if (!newSlide) newSlide=numSlides;
if (newSlide > numSlides) newSlide=1;
document.all[("image"+currentSlide)].style.visibility="hidden";
document.all[("image"+newSlide)].style.visibility="visible";
currentSlide = newSlide;
}
function switchSlide(sDir) {
newSlide = currentSlide + sDir;
if (!newSlide) newSlide=numSlides;
if (newSlide > numSlides) newSlide=1;
document.all[("image"+newSlide)].style.visibility="visible";
document.all[("image"+currentSlide)].style.visibility="hidden";
currentSlide = newSlide;
}
and here's the code for creating my 4 hidden divs from the database:
Code:
<span id="feature" style="position:relative;">
<?
$count =0;
while ($row = mysql_fetch_assoc($result)) {
$count++; $imageid = "image".$count;?>
<DIV id="<?echo $imageid ?>" class="slides">
<table cellpadding=0 cellspacing=0 style="height:245px; border: 1px solid #1A82AC;">
<tr height="165">
<td align=center valign=middle>
<a href="feature.php?show=<?echo $row["feat_id"];?>"><img src="<?echo $row["image_file"];?>" border="0" class="lg"></a>
</td>
</tr>
<tr height="80"><td valign=top bgcolor=#E8F2F7 style="padding: 5px;">
<h1><?echo $row["feature_name"];?></h1><?echo $row["short_desc"];?>
<div style="float: right;"><strong><a href="feature.php?show=<?echo $row["feat_id"];?>">Read More...</a></strong></div></td></tr>
</table>
<table><tr><td align="left"><a href="javascript:switchSlide(-1)">« Prev</a></td><td align="center"><a href="javascript:switchToSlide(1)">1</a> - <a href="javascript:switchToSlide(2)">2</a> - <a href="javascript:switchToSlide(3)">3</a> - <a href="javascript:switchToSlide(4)">4</a></td><td align="right"><a href="javascript:switchSlide(1)">Next »</a></td></table>
</div>
<? } mysql_free_result($result); ?>
</span>
Now with the fix that you just gave me, i'm not quite sure exactly how to implement it.. i'm kinda confusing myself here. Please help further. Thanks
Last edited by megaholic; 08-17-2006 at 08:26 AM..
|