11/10/2009, 21:01
|
| Me alejo de Omelas | | Fecha de Ingreso: mayo-2004 Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años, 7 meses Puntos: 834 | |
Respuesta: imagen oscura,normales Sólo se trata de encimarle a la imagen una capa traslúcida:
Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<script>
function getElementPosition() {
var offsetTrail = this;
var offsetLeft = 0;
var offsetTop = 0;
while (offsetTrail) {
offsetLeft += offsetTrail.offsetLeft;
offsetTop += offsetTrail.offsetTop;
offsetTrail = offsetTrail.offsetParent;
}
return {left:offsetLeft, top:offsetTop};
}
function solapar(e){
var c=document.createElement('div');
c.style.position='absolute';
c.style.zIndex=this.style.zIndex+1;
c.style.width=this.offsetWidth+'px';
c.style.height=this.offsetHeight+'px';
var pos=getElementPosition.call(this);
c.style.top=pos.top+'px';
c.style.left=pos.left+'px';
c.style.backgroundColor='black';
c.style.opacity = .5;
c.style.MozOpacity = .5;
c.style.KhtmlOpacity = .5;
c.style.filter = 'alpha(opacity=50)';
c.style.zoom=1;
addEvent(c,desSolapar,'mouseout');
document.body.appendChild(c);
}
function desSolapar(e){
this.parentNode.removeChild(this);
}
function t(id){return document.getElementById(id);}
function addEvent(obj,fun,type){
if(obj.addEventListener){
obj.addEventListener(type,fun,false);
}else if(obj.attachEvent){
var f=function(){
fun.call(obj,window.event);
}
obj.attachEvent('on'+type,f);
obj[fun.toString()+type]=f;
}else{
obj['on'+type]=fun;
}
}
onload=function(){
addEvent(t('i'),solapar,'mouseover');
}
</script>
</head>
<body>
<img id="i" src="23.jpg" />
</body>
</html>
|