xlegendx
06-06-2006, 12:49 AM
Hey,
This is only a IE bug, all links doesn't work if they are placed into a table that has a semi-transparent background using PNG image.
Here is the code you would need to help me:
<style>
.trans_box {
font-family:verdana;
font-size:10pt;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src='images/gray_semitransparent.png');
}
.trans_box[class] {
background-image:url(images/gray_semitransparent.png);
}
</style>
Can someone help me? Thanks
harbingerOTV
06-06-2006, 01:06 AM
This has been covered alot. Heres a post that went into it and gave a work around or two for the png problem in IE.
http://www.codingforums.com/showthread.php?t=84069&highlight=opacity
what the filter does is basically make the png work but the filter itself sits at a convienet z-index: infinate. so basically it sits above everything in the affected element.
Bill Posters
06-06-2006, 08:13 AM
Having quickly scanned thorugh Harbinger's linked thread, I don't think it covers the OP's problem.
For some reason, making anchor elements relatively positioned fixes the IE/Win issue of links 'over' filtered background images being unclickable.
e.g. (css)
a {
position: relative;
}
xlegendx
06-06-2006, 11:11 AM
Having quickly scanned thorugh Harbinger's linked thread, I don't think it covers the OP's problem.
For some reason, making anchor elements relatively positioned fixes the IE/Win issue of links 'over' filtered background images being unclickable.
e.g. (css)
a {
position: relative;
}
Wow, eheh, it works like a charm.
Thanks!
harbingerOTV
06-07-2006, 02:15 AM
Wow Bill. I knew I had made it work before on some test site but could never figure out what I had done. Seeing that again makes me smack my head.
thanks for that refresher ;)
henry6903
09-10-2009, 04:15 PM
I've got a similar problem, which is that I'm trying to get a transparent image that will lay across my entire page, but will not stop the functionality (e.g. forms, links) of the page. I want it to go right across the form fields as it is in this picture:
http://plaosmos.hostcell.net/transparent-overlay.jpg
Any ideas?
Rowsdower!
09-10-2009, 04:55 PM
I've got a similar problem, which is that I'm trying to get a transparent image that will lay across my entire page, but will not stop the functionality (e.g. forms, links) of the page. I want it to go right across the form fields as it is in this picture:
http://plaosmos.hostcell.net/transparent-overlay.jpg
Any ideas?
Use a separate semi-transparent PNG as a background-image for those input fields. You could do something like a 75% opacity white image, which could be 10x10 pixels for faster loading. You would repeat the background image in the x-axis and y-axis. I think that would be the simplest way.
If not that, then you could make background image pieces out of slices from your PSD and use those unique background images for each input on a fully opaque white background color (since your image example doesn't really look like a true transparency as much as an outline of the scrolling shapes within the input elements). Precise placement of your input fields would be essential in this approach which makes it less attractive.
If your real goal is to actually overlay that image in front of the input elements using z-index then this will not work. You can do it, and it will look how you want it, but you won't be able to actually access the input fields since they will essentially be "under glass."
henry6903
09-11-2009, 10:52 AM
Hi,
Thanks for responding.
The swirl is indeed a 10% opacity white line with a dark border (png). The background of the page is black.
In the image I posted the transparent png was in front using z-index, which removed the ability to click.
I've now got it set up with the png at 100% opacity (for IE6 compatibility) in the background (and now dark-grey), and simply made the forms opacity 0.8. However, this means the forms are not bright white, which is a bit of a shame. More of a problem are images, which would be dull if I set them to 0.8 opacity.
Of course, I could put the 'watermark' manually onto each image, but as you say, that would demand precise positioning, which is not practical given the variety of browsers.
So is there no way to put the transparent png up front in the z-index but transparent to clicks? There's nothing in CSS3 or no way in JS to accomplish this?
Rowsdower!
09-11-2009, 02:07 PM
Hi,
Thanks for responding.
The swirl is indeed a 10% opacity white line with a dark border (png). The background of the page is black.
In the image I posted the transparent png was in front using z-index, which removed the ability to click.
I've now got it set up with the png at 100% opacity (for IE6 compatibility) in the background (and now dark-grey), and simply made the forms opacity 0.8. However, this means the forms are not bright white, which is a bit of a shame. More of a problem are images, which would be dull if I set them to 0.8 opacity.
Of course, I could put the 'watermark' manually onto each image, but as you say, that would demand precise positioning, which is not practical given the variety of browsers.
So is there no way to put the transparent png up front in the z-index but transparent to clicks? There's nothing in CSS3 or no way in JS to accomplish this?
No, as far as I have ever known it's entirely impossible to access elements with the mouse when the z-index is lower than an overlapping element's z-index. You might be able to find something to work in javascript, but it wouldn't be doing the work with z-index.
Now, two points to mention:
1) Opacity in CSS is a CSS 3 recommendation item that isn't supported very well yet.
2) You can use a HTC file to bring IE 5.5 and IE 6 up to speed with PNG opacity to avoid any need for the CSS opacity. There is a similar fix for IE 6 and below to handle their buggy hover implementation. I am attaching both HTC files as a zip for reference -- this is completely unrelated to your problem but is still handy to know. All you have to do to activiate them is put a behavior url in the CSS. This is probably best done with a conditional statement for IE in the header that adds some IE-specific styles for any version less than IE 7. This is done like so:
<!-- Begin IE Hacks... -->
<!--[if lt IE 7]>
<style type="text/css" media="screen">
body {
behavior: url(/css/csshover.htc);
}
img {
behavior: url(/css/iepngfix.htc);
}
</style>
<![endif]-->
<!-- End IE Hacks... -->
This assumes you have loaded both HTC files into the "css" folder, of course.
Full code for iepngfix.htc:<public:component>
<public:attach event="onpropertychange" onevent="iePNGFix(0)" />
<script type="text/javascript">
// IE5.5+ PNG Alpha Fix v1.0
// (c) 2004-2008 Angus Turnbull http://www.twinhelix.com
// This is licensed under the GNU LGPL, version 2.1 or later.
// For details, see: http://creativecommons.org/licenses/LGPL/2.1/
// This must be a path to a blank image, relative to the HTML document(s).
// In production use I suggest '/images/blank.gif' or similar. That's all!
if (typeof blankImg == 'undefined') var blankImg = '/htc/blank.gif';
function filt(s, b)
{
var f = 'DXImageTransform.Microsoft.AlphaImageLoader';
var sM = (currentStyle.backgroundRepeat == 'no-repeat') ? 'crop' : 'scale';
s = (s || '').replace(/\(/g, '%28').replace(/\)/g, '%29');
if (s && !(/IMG|INPUT/.test(nodeName) && !b) &&
currentStyle.width == 'auto' && currentStyle.height == 'auto')
{
style.width = offsetWidth + 'px';
style.height = clientHeight + 'px';
if (currentStyle.display == 'inline') style.display = 'inline-block';
}
if (filters[f])
{
filters[f].enabled = s ? true : false;
if (s) with (filters[f]) { src = s }
}
else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="' + sM + '")';
}
function iePNGFix(init)
{
if (!/MSIE (5\.5|6)/.test(navigator.userAgent) || typeof filters == 'unknown') return;
var evt = init ? { propertyName: 'src,background' } : event;
var isSrc = /src/.test(evt.propertyName);
var isBg = /background/.test(evt.propertyName);
var isClass = !init &&
((this.className != this._png_class) && (this.className || this._png_class));
if (!(isSrc || isBg || isClass)) return;
this._png_class = this.className;
var blank = blankImg.match(/([^\/]+)$/)[1];
// Required for Whatever:hover support - erase any set BG if className changes.
if (isClass && ((style.backgroundImage.indexOf('url(') == -1) ||
(style.backgroundImage.indexOf(blank) > -1)))
{
setTimeout(function() { this.style.backgroundImage = '' }, 0);
return;
}
if (isSrc && this.src && /IMG|INPUT/.test(nodeName))
{
if ((/\.png/i).test(src))
{
filt(src, 1);
src = blankImg;
}
else if (src.indexOf(blank) == -1) filt();
}
var bgSrc = currentStyle.backgroundImage || style.backgroundImage;
if ((bgSrc + this.src).indexOf(blank) == -1)
{
var bgPNG = bgSrc.match(/^url[("']+(.*\.png[^\)"']*)[\)"']+[^\)]*$/i);
if (bgPNG)
{
style.backgroundImage = 'url("' + blankImg + '")';
filt(bgPNG[1], 0);
// Unclickable elements inside PNG backgrounds.
var tags = ['a', 'input', 'select', 'textarea', 'iframe', 'object'],
t = tags.length, tFix = [];
while (t--)
{
var elms = all.tags(tags[t]), e = elms.length;
while (e--) tFix.push(elms[e]);
}
var t = tFix.length;
if (t && (/relative|absolute/i).test(currentStyle.position))
alert('IEPNGFix: Children of positioned element are unclickable:\n\n<' +
nodeName + (id && ' id=' + id) + '>');
while (t--)
if (!(/relative|absolute/i).test(tFix[t].currentStyle.position))
tFix[t].style.position = 'relative';
}
else filt();
}
}
iePNGFix(1);
</script>
</public:component>
Full code for csshover.htc:<public:attach event="ondocumentready" onevent="CSSHover()" />
<script>
/**
* Whatever:hover - V3.00.081222
* --------------------------------------------------------
* Author - Peter Nederlof, http://www.xs4all.nl/~peterned
* License - http://creativecommons.org/licenses/LGPL/2.1
* Packed - http://dean.edwards.name/packer
*
* howto: body { behavior:url("csshover3.htc"); }
*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('r.R=(8(){4 f=/(^|\\s)((([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(C|D|E))/i,S=/(.*?)\\:(C|D|E)/i,T=/[^:]+:([a-z-]+).*/i,U=/(\\.([a-V-W-]+):[a-z]+)|(:[a-z]+)/1c,X=/\\.([a-V-W-]*Y(C|D|E))/i,Z=/1d (5|6|7)/i,10=/1e/i;4 g=\'1f-\';4 h={p:[],t:{},11:8(){n(!Z.F(1g.1h)&&!10.F(r.12.1i))u;4 a=r.12.1j,l=a.v;w(4 i=0;i<l;i++){3.G(a[i])}},G:8(a){n(a.H){I{4 b=a.H,l=b.v;w(4 i=0;i<l;i++){3.G(a.H[i])}}J(13){}}I{4 c=a.1k,l=c.v;w(4 j=0;j<l;j++){3.14(c[j],a)}}J(13){}},14:8(a,b){4 c=a.1l;n(f.F(c)){4 d=a.K.1m,L=S.15(c)[1],M=c.N(T,\'Y$1\'),O=c.N(U,\'.$2\'+M),o=X.15(O)[1];4 e=L+o;n(!3.t[e]){b.16(L,g+o+\':1n(R(3, "\'+M+\'", "\'+o+\'"))\');3.t[e]=17}b.16(O,d)}},18:8(a,b,c){4 d=g+c;n(a.K[d]){a.K[d]=q}n(!a.x)a.x=[];n(!a.x[c]){a.x[c]=17;4 e=19 P(a,b,c);3.p.1o(e)}u b},y:8(){I{4 l=3.p.v;w(4 i=0;i<l;i++){3.p[i].y()}3.p=[];3.t={}}J(e){}}};r.Q(\'1p\',8(){h.y()});4 k={1q:{9:\'1r\',m:\'1s\'},1t:{9:\'1u\',m:\'1v\'},1a:{9:\'1a\',m:\'1w\'}};8 P(a,b,c){3.A=a;3.B=b;4 d=19 1x(\'(^|\\\\s)\'+c+\'(\\\\s|$)\',\'g\');3.9=8(){a.o+=\' \'+c};3.m=8(){a.o=a.o.N(d,\' \')};a.Q(k[b].9,3.9);a.Q(k[b].m,3.m)}P.1y={y:8(){3.A.1b(k[3.B].9,3.9);3.A.1b(k[3.B].m,3.m);3.9=q;3.m=q;3.A=q;3.B=q}};u 8(a,b,c){n(a){u h.18(a,b,c)}1z{h.11()}}})();',62,98,'|||this|var||||function|activator|||||||||||||deactivator|if|cl assName|elements|null|window||callbacks|return|length|for|csshover|unload||node|type|hover|active|fo cus|test|parseStylesheet|imports|try|catch|style|affected|pseudo|replace|newSelect|CSSHoverElement|a ttachEvent|CSSHover|REG_AFFECTED|REG_PSEUDO|REG_SELECT|z0|9_|REG_CLASS|on|REG_MSIE|REG_COMPAT|init|d ocument|securityException|parseCSSRule|exec|addRule|true|patch|new|onfocus|detachEvent|gi|msie|backc ompat|csh|navigator|userAgent|compatMode|styleSheets|rules|selectorText|cssText|expression|push|onbe foreunload|onhover|onmouseenter|onmouseleave|onactive|onmousedown|onmouseup|onblur|RegExp|prototype| else'.split('|'),0,{}));
</script>
henry6903
09-15-2009, 04:36 PM
Wow! Great. Thanks a lot!
henry6903
09-15-2009, 06:06 PM
Out of curiosity, what's the difference between the .htc you gave me and the JS fix here?: http://spirit.vn/en/?p=37
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.