View Full Version : Gradual Highlight Image Script (expanding functionality slightly)

05-27-2006, 03:34 AM
Hi guys,

Right now I'm concerned with the Gradual Highlight Image Script: http://dynamicdrive.com/dynamicindex4/highlightgrad.htm

Version one of this JavaScript is lovely in that with onmouseover, it gradually fades out a background picture while making a different one become absolutely clear. What bothers me is that once I move my mouse off the picture, things change back to their normal state almost instantly. I want the images to change back to their normal states gradually.

So here's where I stand:

fade in (check, happy!)
fade out (no check, unhappy!)

I know about version two, which does exactly what I want. The drawback is that it won't run on both Internet Explorer and Netscape. It's only compatible with IE. Version one, on the other hand, works with both browsers.

Now, since version one can gradually fade in images, I'm inclined to think the latter part of the code can modified to gradually fade out images as well.

I'm referring to this section:
function slowlow(which2){

I'm upset with cleartimer because it's doing this:

function cleartimer(){
if (window.highlighting) clearInterval(highlighting)

I believe cleartimer() is the problem area because the function is clearing the variable highlighting, and I want highlighting to change from being 100 percent defined to practically zero. (with Mozilla, a decimal is used over a percentage, so 1 is used for 100%, while with internet explorer, raw numbers like 100 are fine.

Also, I think I understand the notion of highlighting, but I'm not positive. I bet the person who wrote the code could judge.

I tried writing my own code (for fading back the images) this afternoon, but couldn't achieve my goal. I've done Java programming before, but today was my first shot at JavaScript.

Any pointers? (I'm hoping this question has been asked before)