473,545 Members | 2,073 Online
Bytes | Software Development & Data Engineering Community
+ 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+= 'iVBORw0KGgoAAA ANSUhEUgAAAAoAA ';
bgStart+= 'AAKCAYAAACNMs+ 9AAAAFUlEQVR42m M0SD';
var bgEnd = 'AAAAAElFTkSuQm CC)';
var bgGrade = [
'/wn4EIwDiqkL4KAV bbF2f0aBUI',
'/wjIEIwDiqkL4KAX 59Fm2vBnLj',
'9whoEIwDiqkL4K AZ14FWnd9+Mk',
'+wmYEIwDiqkL4K AcUaFG/cP0wP',
'8wk4EIwDiqkL4K AeQVE2sbcbuX',
'9Qz0AEYBxVSF+F AAMfEmebdV9f',
'+QxkAEYBxVSF+F ACrBEW0gimmK',
'/gy0AEYBxVSF+FAF JjEHMGT84i',
'9gzEAEYBxVSF+F AHFeD29qarCb',
'8gyUAEYBxVSF+F AJBZDmtRyGAL',
'none'
];
var trueColor = '#3067C0';

function $(id) {
return document.getEle mentById(id);
}

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

function demo(n) {
$('div1').style .backgroundImag e = (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.selectedIn dex)">
<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">tran sparent</option>
</select>

</form>

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

</body>

</html>

Jan 9 '06 #1
1 3094
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
8034
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." + productindex + "none"); <snip>
1
1571
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 the line that sets opacity from a loop through all elements: document.forms.elements.style.filter =...
2
2567
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 7.51, even though it displays fine in Mozilla 1.6, Firefox 0.9, Netscape 7.1 and Internet Explorer 6.0 Hope someone can help!
3
1363
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 something specific I need to do, have put simplified example in above url.. (need to do it for relatively-positioned divs AND link that triggers...
8
376
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I detect Opera/Netscape/IE? ----------------------------------------------------------------------- The « navigator » object contains strings which specify the browser and version; however, this is in general not very genuine. Mozilla (and therefore...
3
1469
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, the 'title' check changes, etc - it just doesn't "fire" when you click the icon/image in Mozilla, etc but DOES in Internet Explorer... That is...
9
1266
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) document.getElementById("inner").style.backgroundColor = GetStyle("box", "backgroundColor"); document.getElementById("box").style.backgroundColor = "transparent";...
4
2095
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 the play image is clicked and then the user has the choice of 2 images to answer a question. The code below deals with the first of the 2 images...
4
2319
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 "FadeClass" that I can use to fade windows in my programs. I am using Visual C# 2008 Express right now. This is my "Form1.cs" in it's current state: ...
0
7405
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7659
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7428
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7760
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5334
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4949
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3455
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1887
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1019
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.