cre8ive
Dec 13th 2007, 10:34 pm
Opacity in IE(6) does not always work well, but workarounds are suggested. The following is one of them; http://www.makemineatriple.com/2007/05/opacity_text_issues. This suggests to set
position: relative;
Or …
background-color: #xxyyzz;
I tried this, but it did not work in my particular case. When I run the following JavaScript functions, …
<script type="text/javascript">
// ==================================================
// ===== 3D parallax navigator ====
// script written by Gerard Ferrandez - January 2007
// http://www.dhteumeuleu.com
// ==================================================
var prx = {
cx : 0,
cy : 0,
X : 0,
Y : 0,
CX : 0,
CY : 0,
FO : 6, // focal
RS : .05, // speed
RC : 1,
/* ==== mouse move event ==== */
mousemove : function (e) {
if (window.event) e = window.event;
prx.xm = (e.x || e.clientX) - prx.nx + (prx.nw * .5);
prx.ym = (e.y || e.clientY) - prx.ny + (prx.nh * .5);
},
/* ==== window resize event ==== */
resize : function () {
prx.nx = pxLeft(prx.scr);
prx.ny = pxTop(prx.scr);
prx.nw = prx.scr.offsetWidth;
prx.nh = prx.scr.offsetHeight;
},
/* ==== main loop ==== */
run : function () {
/* ==== mouse soften ==== */
prx.cx += (prx.xm - prx.cx) * (prx.RS * 2 * prx.RC);
prx.cy += (prx.ym - prx.cy) * (prx.RS * 2 * prx.RC);
/* ==== goto soften ==== */
prx.CX += (prx.X - prx.CX) * (prx.RS * prx.RC);
prx.CY += (prx.Y - prx.CY) * (prx.RS * prx.RC);
/* ==== prx move ==== */
for (var i = 0; i < prx.N; i++) {
var o = prx.spa[i];
o.style.left = px(o.m + prx.nw * .5 + (o.X - prx.cx * .5 - prx.CX) * o.d);
o.style.top = px(o.m + prx.nh * .5 + (o.Y - prx.cy * .5 - prx.CY) * o.d);
}
setTimeout(prx.run, 16);
},
/* ==== init script ==== */
init : function (container) {
this.scr = id(container);
this.ref = {};
this.spa = [];
var k = 0;
var r = this.scr.childNodes;
for (var i = 0, n = r.length; i < n; i++) {
/* ==== for each group ==== */
var o = r[i];
if (o.id) {
/* ==== save coordinates ==== */
var X = o.offsetLeft;
var Y = o.offsetTop;
this.ref[o.id] = {};
this.ref[o.id].X = X;
this.ref[o.id].Y = Y;
this.ref[o.id].W = o.offsetWidth;
this.ref[o.id].H = o.offsetHeight;
o.style.position = 'static';
var c = o.getElementsByTagName('*');
for (var j = 0, m = c.length; j < m; j++) {
/* ==== for each parallax object [class="prx"] ==== */
if (c[j].className.indexOf('prx') >= 0) {
var s = this.spa[k] = c[j];
/* ==== zIndex = parallax level ==== */
s.Z = s.style.zIndex;
s.d = Math.min(prx.FO, prx.FO / (prx.FO + 1 - s.Z));
/* ==== x,y coordinates - group + local ==== */
s.X = X + s.offsetLeft;
s.Y = Y + s.offsetTop;
/* ==== zoom factor (% sizes only) ==== */
s.W = s.offsetWidth * ((!s.style.width || s.style.width.indexOf('px') > 0) ? 1 : s.d);
s.H = s.offsetHeight * ((!s.style.height || s.style.width.indexOf('px') > 0) ? 1 : s.d);
s.style.width = px(s.W);
s.style.height = px(s.H);
/* ==== buttons/links ==== */
if(s.onclick) {
s.style.cursor = 'pointer';
s.style.zIndex = 100;
s.onmouseover = function() {
this.m = 2;
prx.RC = .5;
}
s.onmouseout = function() {
this.m = 0;
prx.RC = 1;
}
}
/* ==== navigation functions ==== */
s.goto = function (o, ret) {
prx.RC = 1;
if (!ret) id(o).O = this.oid;
id(o).style.visibility = 'visible';
prx.X = prx.ref[o].X - .5 * (prx.nw - prx.ref[o].W);
prx.Y = prx.ref[o].Y - .5 * (prx.nh - prx.ref[o].H);
}
s.ret = function () {
this.goto(this.p.O, true);
}
s.hide = function () {
setTimeout('id("' + this.oid + '").style.visibility = "hidden";', 500);
}
s.oid = o.id;
s.p = o;
s.m = 0;
k++;
}
}
}
}
this.N = this.spa.length;
/* ==== resize & mouse events ==== */
addEvent(window, 'resize', this.resize);
addEvent(window.document, 'mousemove', this.mousemove);
/* ==== start ==== */
this.resize();
this.xm = this.nw;
this.ym = this.nh;
this.scr.style.visibility = 'visible';
this.run();
}
}
onload = function() {
/* ==== init ==== */
setTimeout("prx.init('screen')", 500);
}
</script>
(By the way, this code is used in this DHTML website; http://www.dhteumeuleu.com/dhtml/nav-3D.html.)
… opacity in IE gets messed up. Well, it just doesn’t work. Why??? How can I fix this problem?
position: relative;
Or …
background-color: #xxyyzz;
I tried this, but it did not work in my particular case. When I run the following JavaScript functions, …
<script type="text/javascript">
// ==================================================
// ===== 3D parallax navigator ====
// script written by Gerard Ferrandez - January 2007
// http://www.dhteumeuleu.com
// ==================================================
var prx = {
cx : 0,
cy : 0,
X : 0,
Y : 0,
CX : 0,
CY : 0,
FO : 6, // focal
RS : .05, // speed
RC : 1,
/* ==== mouse move event ==== */
mousemove : function (e) {
if (window.event) e = window.event;
prx.xm = (e.x || e.clientX) - prx.nx + (prx.nw * .5);
prx.ym = (e.y || e.clientY) - prx.ny + (prx.nh * .5);
},
/* ==== window resize event ==== */
resize : function () {
prx.nx = pxLeft(prx.scr);
prx.ny = pxTop(prx.scr);
prx.nw = prx.scr.offsetWidth;
prx.nh = prx.scr.offsetHeight;
},
/* ==== main loop ==== */
run : function () {
/* ==== mouse soften ==== */
prx.cx += (prx.xm - prx.cx) * (prx.RS * 2 * prx.RC);
prx.cy += (prx.ym - prx.cy) * (prx.RS * 2 * prx.RC);
/* ==== goto soften ==== */
prx.CX += (prx.X - prx.CX) * (prx.RS * prx.RC);
prx.CY += (prx.Y - prx.CY) * (prx.RS * prx.RC);
/* ==== prx move ==== */
for (var i = 0; i < prx.N; i++) {
var o = prx.spa[i];
o.style.left = px(o.m + prx.nw * .5 + (o.X - prx.cx * .5 - prx.CX) * o.d);
o.style.top = px(o.m + prx.nh * .5 + (o.Y - prx.cy * .5 - prx.CY) * o.d);
}
setTimeout(prx.run, 16);
},
/* ==== init script ==== */
init : function (container) {
this.scr = id(container);
this.ref = {};
this.spa = [];
var k = 0;
var r = this.scr.childNodes;
for (var i = 0, n = r.length; i < n; i++) {
/* ==== for each group ==== */
var o = r[i];
if (o.id) {
/* ==== save coordinates ==== */
var X = o.offsetLeft;
var Y = o.offsetTop;
this.ref[o.id] = {};
this.ref[o.id].X = X;
this.ref[o.id].Y = Y;
this.ref[o.id].W = o.offsetWidth;
this.ref[o.id].H = o.offsetHeight;
o.style.position = 'static';
var c = o.getElementsByTagName('*');
for (var j = 0, m = c.length; j < m; j++) {
/* ==== for each parallax object [class="prx"] ==== */
if (c[j].className.indexOf('prx') >= 0) {
var s = this.spa[k] = c[j];
/* ==== zIndex = parallax level ==== */
s.Z = s.style.zIndex;
s.d = Math.min(prx.FO, prx.FO / (prx.FO + 1 - s.Z));
/* ==== x,y coordinates - group + local ==== */
s.X = X + s.offsetLeft;
s.Y = Y + s.offsetTop;
/* ==== zoom factor (% sizes only) ==== */
s.W = s.offsetWidth * ((!s.style.width || s.style.width.indexOf('px') > 0) ? 1 : s.d);
s.H = s.offsetHeight * ((!s.style.height || s.style.width.indexOf('px') > 0) ? 1 : s.d);
s.style.width = px(s.W);
s.style.height = px(s.H);
/* ==== buttons/links ==== */
if(s.onclick) {
s.style.cursor = 'pointer';
s.style.zIndex = 100;
s.onmouseover = function() {
this.m = 2;
prx.RC = .5;
}
s.onmouseout = function() {
this.m = 0;
prx.RC = 1;
}
}
/* ==== navigation functions ==== */
s.goto = function (o, ret) {
prx.RC = 1;
if (!ret) id(o).O = this.oid;
id(o).style.visibility = 'visible';
prx.X = prx.ref[o].X - .5 * (prx.nw - prx.ref[o].W);
prx.Y = prx.ref[o].Y - .5 * (prx.nh - prx.ref[o].H);
}
s.ret = function () {
this.goto(this.p.O, true);
}
s.hide = function () {
setTimeout('id("' + this.oid + '").style.visibility = "hidden";', 500);
}
s.oid = o.id;
s.p = o;
s.m = 0;
k++;
}
}
}
}
this.N = this.spa.length;
/* ==== resize & mouse events ==== */
addEvent(window, 'resize', this.resize);
addEvent(window.document, 'mousemove', this.mousemove);
/* ==== start ==== */
this.resize();
this.xm = this.nw;
this.ym = this.nh;
this.scr.style.visibility = 'visible';
this.run();
}
}
onload = function() {
/* ==== init ==== */
setTimeout("prx.init('screen')", 500);
}
</script>
(By the way, this code is used in this DHTML website; http://www.dhteumeuleu.com/dhtml/nav-3D.html.)
… opacity in IE gets messed up. Well, it just doesn’t work. Why??? How can I fix this problem?