Low Bandwidth Rollovers: Click Effect in IE | WebReference

Low Bandwidth Rollovers: Click Effect in IE

Logo

Low Bandwidth Rollovers:
creating a click effect for IE with a third image


If you are using Explorer 4, click on the image map below.

This pinch effect is, of course, created by clipping a third overlayed image whenever the mousedown and mouseup events fire over an AREA.

First, prepare a third image with the pinch effect:

Add the CSS element:

    #elMenuDown {
        position: absolute;
        visibility: hidden;
        top: 0;
        left: 0
    }

Add a new string variable for the third image you've created:

    if (IE4) { thirdIm = "<IMG SRC='menudown.gif' USEMAP='#mpMenu' WIDTH=468 HEIGHT=18 BORDER=0>"; } else { thirdIm = "" }

Add the function:

    function mapDown(which,on) { if (!IE4) { return } whichEl = document.all.elMenuDown.style; if (!on) { whichEl.visibility = "hidden"; return } clLeft = arPopups[which][0]; clRight = arPopups[which][1]; whichEl.clip = "rect(" + clTop + " " + clRight + " " + clBot + " " + clLeft + ")"; whichEl.visibility = "visible" }

Insert your new image as a CSS element, nested in elMenu and after elMenuOver, dynamically with JavaScript:

    <DIV ID="elMenuDown"> <SCRIPT LANGUAGE="JavaScript">document.write(thirdIm)</SCRIPT> </DIV>

And finally, modify the MAP's 7 links to include the two events:

    onMouseDown="mapDown(linkNumber,true)" onMouseUp="mapDown(linkNumber,false)"

Rollover with 1 (one) Image

You read that correctly. Just 1, but it's a cheat, in a way. If you're still with us, read on!

Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: 08/06/97
Revised: 10/16/97

URL: https://www.webreference.com/dhtml/column2/IEdown.html