gli Posted June 23, 2008 Share Posted June 23, 2008 Hi! First, im begginer to JavaScript. I have script that force opacity from max to nothing. I use two opacities, one for ie: opacity and css3 standard filter:alpha(opacity=x). All is ok with 'opacity' , but with second css3 standard is problem, i dont know if i add it right in my JavaScript because of continue after the word 'filter:' , first one is just simple 'opacity' So there is the code: var opacity2 = 100 function fadeout2() { if(opacity2 >= 1) { opacity2 = opacity2 - 10; document.getElementById('box2').style.filter='alpha(opacity=' + opacity2 + ')'; window.setTimeout('fadeout2()', 60); } else { document.getElementById('box2').style.visibility="active"; } } and here is code for 'opacity' which are working var opacity = 1 function fadeout() { if(opacity >= 0.1) { opacity = opacity - 0.1; document.getElementById('box2').style.opacity=opacity; window.setTimeout('fadeout()', 60); } else { document.getElementById('box2').style.visibility="hidden"; } } Thanks and sorry for my bad English. Link to comment https://forums.phpfreaks.com/topic/111460-solved-css3-standard-opacity-in-javascript/ Share on other sites More sharing options...
gli Posted June 23, 2008 Author Share Posted June 23, 2008 omg. i just forgot to add event for fadeout2() function in html file. Link to comment https://forums.phpfreaks.com/topic/111460-solved-css3-standard-opacity-in-javascript/#findComment-572384 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.