Welcome to WebmasterWorld Guest from 54.204.162.36

Forum Moderators: open

Passing an onClick event through a Div

Help with a workaround.

   
4:11 pm on Sep 23, 2008 (gmt 0)

5+ Year Member



I have exhausted my javascript knowledge. The shadow div (a png overlay) contains a background image that is preventing me from clicking an underlying image banner. Could I just use a document.getElementById tag on the "shadow" div and then change the url for the ID being called based on what the current banner offset is?

Any help on this is appreciated, thanks!


<div class="slideshow">
<div id="shadow"></div>
<div id="arrow"></div>
<div id="menu">
<ul>

<li><a href="/banner/img.jpg" onmouseover="pauseSlideAt(<%= i + 1 %>)" onmouseout="startSlide()">bannertitle</a>
<li><a href="/banner/img2.jpg" onmouseover="pauseSlideAt(<%= i + 1 %>)" onmouseout="startSlide()">bannertitle2</a>

</ul>
</div>

<div id="slide">

<a href="/banner"><img height="270" src="13.jpg" width="627" /></a>
<a href="/banner2"><img height="270" src="1.jpg" width="627" /></a>

</div>
</div>

<script type="text/javascript">
featureOffsets = ["0","-627","-1254","-1881","-2508"]
sliderOffsets = ["-593","-473","-353","-233","-113"]
totalSlides = main_banners.size
currentSlide = 1
playSpeed = 5000

function playSlide() {
if (currentSlide == 1) { direction = "forward"; };
if (currentSlide == totalSlides) { direction = "back" };
if (direction == 'forward') {moveSlide(currentSlide + 1,1)} else {moveSlide(currentSlide - 1,1)}
ct=setTimeout("playSlide()", playSpeed);
}

function moveSlide(slideNumber,duration) {
duration = duration 0.5
mF = new Effect.Move('slide', { x:featureOffsets[slideNumber - 1], mode: 'absolute', duration:duration });
mS = new Effect.Move('arrow', { x:sliderOffsets[slideNumber - 1], y: 210, mode: 'absolute', duration:duration });
currentSlide = slideNumber;
}

function startSlide() {
direction='forward'
ct=setTimeout('playSlide();',playSpeed);
}

function cancelSlide() {
if (typeof(mF) != "undefined") {mF.cancel()};
if (typeof(mS) != "undefined") {mS.cancel()};
}

function pauseSlideAt(slideNumber) {
cancelSlide();
clearTimeout(ct);
moveSlide(slideNumber);
currentSlide = slideNumber;
}

startSlide();
</script>

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month