Hi, I created a simple page that demonstrates setOpacity NOT working
consistently between Firefox3, InternetExplorer7, Opera9, and Safari3:
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript">
document.observe("dom:loaded", observeElement);
function observeElement() {$('clickMe').observe('click', opacityDiv);}
function opacityDiv() {
var newDiv = new Element('div', {style: 'position:absolute; top:0px;
left:0px; width:100%; height:100%; background:black;'});
Element.extend(document.body);
document.body.insert({bottom: newDiv}).setOpacity(0.5);
}
</script>
<body>
<div id="clickMe">Click Me!</div>
</body>
Instead of using setOpacity, it is better to use CSS to set consistent
opacity among various browsers:
function opacityDiv() {
var newDiv= new Element('div', {style: position:absolute; top:0px;
left:0px; 'width:100%; height:100%; background:black;
filter:alpha(opacity = 50); -moz-opacity:0.5; -khtml-opacity:0.5;
opacity:0.5;'});
Element.extend(document.body);
document.body.insert({bottom: newDiv});
}
- Paul
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---