homepage Welcome to WebmasterWorld Guest from 54.211.80.155
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Passing an onClick event through a Div
Help with a workaround.
KarlMarks




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

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>

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved