Click to See Complete Forum and Search --> : Dynamic opacity in Moz/Netscrape


JPnyc
05-13-2004, 12:07 PM
Has anyone done this besides me? I'm having a real problem with a bug in these 2 browsers. I've tried and searched any number of places with no responses yet. When changing the opacity in these 2 browsers with javascript, the elements "blink" as they reach 100% opacity. Has anyone experienced this, and has anyone heard of a workaround? Thanks. The effect is perfect in IE and Safari, but these 2 are really limiting my use of a slick visual effect.

David Harrison
05-13-2004, 05:22 PM
I've not had any problems, here's a script that works fine on my PC, try it on yours.

JPnyc
05-13-2004, 06:12 PM
Thanks, but the statement that does the actual fading is identical to what I use. The images blink in Moz/NS when they reach 100% opacity. Maybe the solution is to not let them quite REACH 100%. I think I'll try it. Thanks for the help. By the way, Moz no longer uses MozOpacity to access or set the property. Only NS does now. Mozilla and safari just use opacity. Probably what the standard will be one day. Opera hasn't bothered with it at all yet.

David Harrison
05-13-2004, 06:18 PM
Doesn't blink at all on mine, what browser are you using? Also, if your CPU is a bit slow or is stressed out by doing lots of other things at once then it may cause the browser to stutter.
Originally posted by DUNSEL
Thanks for the help. By the way, Moz no longer uses MozOpacity to access or set the property. Only NS does now. Mozilla and safari just use opacity.Are you quite sure, if this is true then Mozilla are promoting proprietary code by not using the vendor specific -moz prefix.

JPnyc
05-13-2004, 06:34 PM
It blinks in the latest mozilla, and firefox, and netscrape 7.1, however NOT in Netscrape 6.2, IE (any version) or Safari. And it happens on any number of pc's regardless of speed.

JPnyc
05-13-2004, 06:43 PM
Originally posted by lavalamp
Are you quite sure, if this is true then Mozilla are promoting proprietary code by not using the vendor specific -moz prefix.

Yeah, I have a sniffer and the functions that work in it use plain old opacity, just like Safari. My sniffer has both of them in the same test. NS still uses mozOpacity in JS and -moz-opacity for the css.

David Harrison
05-13-2004, 06:49 PM
I think I see what you mean now, although I didn't really notice it before.Originally posted by
DUNSEL
Maybe the solution is to not let them quite REACH 100%.I suppose that if you only let them get to 99% then that would be OK because it's not like it would be noticable.

Weird.

JPnyc
05-13-2004, 06:56 PM
Yeah I don't know why that didn't occur to me until this convo with you, but it didn't. Seems bloody obvious all of a sudden. Perhaps I was hitting the bottle ;-) I can't test anyway till work tomorrow. I don't have all the necessary browsers on my home pc. I hate em so I don't want em cluttering up my HD.

David Harrison
05-13-2004, 06:59 PM
You hate Mozilla??????????????????????????????????

JPnyc
05-13-2004, 07:10 PM
Thoroughly. Not so much as a user, but Javascript is my favorite language and it and NS both run it SOOOOO SLOOOOOOOOOOOOWWWWWWWWWW! Make me crazy. In IE and Safari, my function for the opacity bit is an array of elements. Nice, short and sweet and tidy. But because Moz/NS are SO SLOW I had to code their functions separately. I mean several different functions(1 for each element), each calling the next. That runs faster than an array, for some reason. When I used an array, even with setTimeout, 0, it was still too slow.

David Harrison
05-13-2004, 07:16 PM
Can I see your code? Maybe I can optimise it a bit.

JPnyc
05-13-2004, 07:31 PM
el= new Array('fade','fade2','fade3','fade4'), a=0, op=0;

function fadeIn() {

var to_fade = document.getElementById(el[a]);

if (op < 100) {

to_fade.style.opacity = op/100;
op+=4;

} else {

op = 0;
a++;

}

if (a < 4) {

setTimeout("fadeIn()",0);

}

}

JPnyc
05-14-2004, 08:57 AM
By the way, LL, I was wrong about mozilla's syntax. It does respond to mozOpacity. It was passing the test for netscape in my sniffer and using the netscape functions. Wasn't until I commented them out that I discovered this.

David Harrison
05-14-2004, 09:05 AM
Lol, I guess you and Mozilla can now be friends, I expect you'll download Firefox immediately and browse the web as it's meant to be browsed. ;)

JPnyc
05-14-2004, 09:16 AM
LOL, no, that has nothing to do with the speed at which it runs JS. It was using the netscape functions, which as I said, were written separately rather than using an array like the one I posted, because it just ran that function too damn slow. Also, I'm a windows user. With all it's trials and tribulations, it's still a fact. There's a convenience to being able to shift from browser to regular window and back with impunity that I don't think I'll ever give up.

David Harrison
05-14-2004, 09:22 AM
Erm... why can't you shift from Mozilla to a regular window and back again? I do it all the time.

Also, you can use tabbed browsing with Mozilla which comes in very handy, although sometimes I still get so many windows open I have to scroll. :D
I'm a Windows XP user, I don't have anything aginst the OS but the browser sucks.

JPnyc
05-14-2004, 09:34 AM
It's less convenient. In a windows OS virtually any window is a browser, and vice versa. I can just click "folders' and see my entire OS file system. Firefox doesn't have such an icon. Have to go through the addy bar. And it's the same interface as the rest of the OS. Also, IE is faster at EVERYTHING. Not just JS, but pages, and the app itself. Also, I can configure the toolbars more than any browser on the market. I want maxiumum page, minimum app. I have a title bar, menu and address bar are one, and a toolbar. Takes up about an inch of my screen at the top.

In order to do that with firefox you have to have minimal icons on the toolbar. Yet theres all that wasted space to the right of the menus. Just dead gray space sitting there.

Tabbed browsing is ok, but it's really only of value to me at work. At home I have a 3mb down BB connection, and pages load literally in less than 2 seconds, under normal circumstances. Tabbed browsing doesn't save time anyway, because once you get back there, you STILL have to refresh or you're just seeing what you saw before.