This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > February 2006 > - Transitional image rollovers...





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author - Transitional image rollovers...
MS

2006-02-07, 11:09 pm

I found the following script, which will swap two images for one another on
mouseover, but do so gradually.

This only works on IE (not Firefox or Mac). I was told that this can now be
made to work on all major browsers. Could someone point me to a script that
can show me how?

/*******************************************************************
*
* Function : transIn /transOut
*
* Description : Detects browser that can do opacity and fades the images
* For browsers that do not support opacity it just does an image swap.
* (I only know about NS4 but maybe IE on a Mac also ?)
* For these functions to work you need to name the image
* e.g. for an image named "home" you need
* <IMG .... NAME="home">
* and you need 2 images, the on and the off image
*****************************************************************/
JSFX.transIn = function(imgName, rollName)
{
if(rollName == null)
rollName=imgName;

/*** Stop emails because the rollover was named incorrectly ***/
if(!JSFX.RolloverObjects[rollName])
{
JSFX.Rollover.error(rollName);
return;
}

var img = JSFX.findImg(imgName, document);
if(JSFX.hasFilters(img))
JSFX.imgTransIn(img, JSFX.RolloverObjects[rollName].img_src);
else
{
if(img.offSrc==null)
img.offSrc=img.src;
img.src=JSFX.RolloverObjects[rollName].img_src;
}
}
JSFX.transOut = function(imgName)
{
var img = JSFX.findImg(imgName, document);
if(JSFX.hasFilters(img))
JSFX.imgTransOut(img);
else
img.src=img.offSrc;
}


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews