473,493 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Opera dynamic opacity: solved

VK
Formally it may appertain to a CSS newsgroup, but from the other side
it is *dynamic* plus it is JavaScript based.

Anyway I had a customer who wanted cross-browser full-Aqua (Office XP
style) so I had to hack Opera for it.

This algorithm formally *doesn't* break a single standard, moreover it
works as intended on Opera only (I hope they did not mean *that* as
their official opacity path).

Fill free to use this approach if you need it. (Watch line breaks as
usual).

P.S. I'm currently totally traumatized by transparency, I hate it, hate
it, hate it!
:-| :-)

<html>
<head>
<title>Opera Opacity</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<style type="text/css">
body {
background-color: #FFFFFF;
}

#LoremIpsum {
width: 75%;
font: 1.2em "Times New Roman", serif;
}

#div1 {
left: 20px;
top: 20px;
background-color: #3067C0;
}

..floating {
font: bold small-caps 1em "Times New Roman", Times, serif;
margin: 0px 0px;
padding: 5px 5px;
border: 1px #0000FF solid;
position: absolute;
z-index: 1;
height: 100px;
width: 200px;
}
</style>

<script type="text/javascript">
var bgStart = 'url(data:image/png;base64,';
bgStart+= 'iVBORw0KGgoAAAANSUhEUgAAAAoAA';
bgStart+= 'AAKCAYAAACNMs+9AAAAFUlEQVR42mM0SD';
var bgEnd = 'AAAAAElFTkSuQmCC)';
var bgGrade = [
'/wn4EIwDiqkL4KAVbbF2f0aBUI',
'/wjIEIwDiqkL4KAX59Fm2vBnLj',
'9whoEIwDiqkL4KAZ14FWnd9+Mk',
'+wmYEIwDiqkL4KAcUaFG/cP0wP',
'8wk4EIwDiqkL4KAeQVE2sbcbuX',
'9Qz0AEYBxVSF+FAAMfEmebdV9f',
'+QxkAEYBxVSF+FACrBEW0gimmK',
'/gy0AEYBxVSF+FAFJjEHMGT84i',
'9gzEAEYBxVSF+FAHFeD29qarCb',
'8gyUAEYBxVSF+FAJBZDmtRyGAL',
'none'
];
var trueColor = '#3067C0';

function $(id) {
return document.getElementById(id);
}

function init() {
with ($('div1').style) {
backgroundColor = 'transparent';
backgroundRepeat= 'repeat';
backgroundImage = bgStart+bgGrade[0]+bgEnd;
}
}

function demo(n) {
$('div1').style.backgroundImage = (n != 10)?
bgStart+bgGrade[n]+bgEnd : bgGrade[n];
}

window.onload = init;
</script>

</head>

<body>

<p id="LoremIpsum">
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua.Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
</p>
<p>&nbsp;</p>
<form method="POST" action="">
<select name="opacity" onchange="demo(this.selectedIndex)">
<option value="0" selected>opaque</option>
<option value="1">10</option>
<option value="2">20</option>
<option value="3">30</option>
<option value="4">40</option>
<option value="5">50</option>
<option value="6">60</option>
<option value="7">70</option>
<option value="8">80</option>
<option value="9">90</option>
<option value="10">transparent</option>
</select>

</form>

<div id="div1" class="floating">
Lorem ipsum dolor sit amet
</div>

</body>

</html>

Jan 9 '06 #1
1 3090
VK wrote :

[snipped]
This algorithm formally *doesn't* break a single standard, moreover it
works as intended on Opera only (I hope they did not mean *that* as
their official opacity path).

I tried your demo and it worked (the onchange implementation is a bit
buggy, iffy in Opera 9 beta 1). Amazing! But to say that your demo is a
solution to Opera's lack of support for CSS3 opacity is a bit too far
for me. I have asked Opera dev. many months before to support CSS3
opacity: CSS3 color module has been a CR since may 2003. The real
solution would come from supporting css opacity just like recent Mozilla
releases.

The nr1 problem with your demo is that it can not be easily implemented;
your demo is a difficult, complex workaround, not a real/complete solution.

Fill free to use this approach if you need it. (Watch line breaks as
usual).

Gérard
--
remove blah to email me
Jan 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
8019
by: Simon | last post by:
Am using the following code. <script language="JavaScript1.2"> function setquantity(productindex,productquantity) { //create the reference object irefname_none = eval("document." +...
1
1570
by: Simon | last post by:
In IE I have a routine that dynamically assigns objects' opacity. This works fine for some elements but not for others. It works for buttons and inputs but not for img, span and select. This is...
2
2560
by: Martin Doyle | last post by:
Ok, I'm building a JS-based limitless-sublevel dynamic menu and am making it cross browser as well - 3 packs of aspirin so far and counting ;) I'm having a weird rendering problem using Opera...
3
1362
by: maya | last post by:
I'm trying to chg opacity for some divs on a pg, IE is ignoring it.. (works fine in FF..) why is this.. html, css, JS code is here.. http://www.francesdelrio.com/opacity.html this is for...
8
376
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I detect Opera/Netscape/IE? ----------------------------------------------------------------------- The...
3
1458
scubak1w1
by: scubak1w1 | last post by:
Hello, I have a form pretty much as below but it only works in IE - not Firefox, Opera, etc The AJAX changes the query button in non-IE browsers, at least in the sense it is not opaque anymore,...
9
1263
by: Piotr K | last post by:
Ok, I tried simply everything that came to my mind and now I ran out of ideas, but to the point - take a look at the code below // GetStyle returns given style value (works fine)...
4
2087
by: Geoff Cox | last post by:
Hello, I have just tried using the latest version of Opera on some code which works OK with IE, FF and Safari but there is probably a better way of writing the code. A sound is played when...
4
2313
by: =?Utf-8?B?R29yZnk=?= | last post by:
Hey everyone. This is only my first week with C#, but I use actionscript a lot in Flash, so I have a very basic understanding of programming, but bear with me... I am trying to create a...
0
7119
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6873
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5453
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4889
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
644
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.