Can't retrieve the opacity value of an object

VERIFIED INVALID

Status

()

P3
normal
VERIFIED INVALID
19 years ago
18 years ago

People

(Reporter: shashi, Assigned: jst)

Tracking

Trunk
x86
Windows 98
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

19 years ago
I have the following script:

function fadeImage(start, finish, step, speed){       
   if (start < finish){      	   
    document.getElementById("image").style.opacity = start;  
    start=start+step; 
    setTimeout("fadeImage("+start+","+finish+","+step+","+speed+")",speed);
   }
   if (start == 0.33) {
    someFunction();
   }	       
}

Of key interest is the second "if" statement. Once the opacity reaches 0.33, I 
want another function to kick-in. But the problem is that Mozilla is unable to 
retrieve the opacity value so the second function never gets started.

This problem does not occur with any other CSS property. It is strictly limited 
to opacity.
'opacity' is not a CSS property, and should probably be renamed to 
'-moz-opacity'.  (It is in SVG, though, but we don't really support SVG...)
(Reporter)

Comment 2

19 years ago
I know that opacity is not a CSS property but since it is "used" like a CSS 
property, for practical purposes it makes life easier by calling it one.

But we aren't here for semantics, are we???
(Assignee)

Comment 3

19 years ago
I can't see any place in that code where you're retrieving the opacity of an
object. If the problem is that "start" never reaches 0.33 in the above code and
there's no other code involved, the code doesn't show any problem with
retrieving the opacity from an object. All I see that sets the value of "start"
is "start = start+step", no opacity retrieveing involved AFAIK.

I ran a small test that does:

  element.style.opacity = 0.5;
  dump(element.style.opacity + "\n");

and I do get "0.5" on the console.

Looks like there's either a problem in the JS above, or the caller of that code
doesn't pass the correct arguments if start never reaches 0.33

And yes, David it right, opacity will probably be renamed to -moz-opacity (and
the DOM property will be renambed to some other name since '-' is not allowd
in property names).

Marking INVALID.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → INVALID

Comment 4

18 years ago
Source code problem. Not ours, marking as verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.