Paddel: Mouseover Fadeeffekt

Beitrag lesen

Hallo alle,
ich hänge zur Zeit an dem Problem, dass ich einen Script für das Faden von Bildern bei Mouseover gefunden habe (50% --> 100% Opacity), jedoch das ganze nicht umdrehen kann.
Zur Zeit fadet das Script beim Mouseout das Bild nicht wieder auf 50% runter sondern es springt direkt auf 50%.

hier der ursprüngliche Script:

#################################################################

<script language="JavaScript">
function increase(img) {
    theobject = img;
    highlighting = setInterval("highlight(theobject)",75);
}
function decrease(img) {
        clearInterval(highlighting);
   if (img.style.MozOpacity)
        img.style.MozOpacity = 0.5;
   else if (img.filters)
       img.filters.alpha.opacity = 50;
}
function highlight(img) {
    if (img.style.MozOpacity < 1)
        img.style.MozOpacity = parseFloat(img.style.MozOpacity) + 0.1;
    else if (img.filters && img.filters.alpha.opacity < 100)
        img.filters.alpha.opacity += 5;
    else if (window.highlighting)
        clearInterval(highlighting);
}
</script>

#################################################################

Hier mein umgearbeiteter: (funktioniert nicht)

<script language="JavaScript">
function increase(img) {
    theobject = img;
    highlighting = setInterval("highlight(theobject)",75);
}
function decrease(img) {
    theobject = img;
    decreasing = setInterval("dehighlight(theobject)",75);
}
function dehighlight(img){
        clearInterval(highlighting);
    if (img.style.MozOpacity > 0.5)
        img.style.MozOpacity = parseFloat(img.style.MozOpacity) - 0.1;
    else if (img.filters && img.filters.alpha.opacity > 50)
        img.filters.alpha.opacity -= 5;
    else if (window.decreasing)
        clearInterval(dehighlighting);
}
function highlight(img) {
        clearInterval(dehighlighting);
    if (img.style.MozOpacity < 1)
        img.style.MozOpacity = parseFloat(img.style.MozOpacity) + 0.1;
    else if (img.filters && img.filters.alpha.opacity < 100)
        img.filters.alpha.opacity += 5;
    else if (window.highlighting)
        clearInterval(highlighting);
}
</script>

#################################################################

Ich hoffe ihr könnt mir irgendwie bei dem Problem weiterhelfen .. ist zwar nicht weltbewegendes wäre aber doch eine kleine aber feine Verbesserung :)

mfG Paddel