General Question

stephen's avatar

The png looks bad in IE7 after I change its opacity with javascript?

Asked by stephen (351points) June 16th, 2008

these day i m working on a web app, and i want to design a control panel in it, when i press mouse down on this panel the javascript codes change its opacity(opacity=70,and i can drag it),and when the mouse up it return back to the normal status(opacity=100),
......
$(ele).onmousedown=function(e){
dragElement.gos=true;
var e=e||window.event;
dragElement.x=e.clientX;
dragElement.y=e.clientY;
dragElement.l=$(drago).offsetLeft;
dragElement.t=$(drago).offsetTop;
$(drago).style.left=dragElement.l+“px”;
$(drago).style.top=dragElement.t+“px”;
$(drago).style.filter=“alpha(opacity=”+70+”)”; //ie7 sucks
$(drago).style.opacity=0.7;

}
$(ele).onmousemove=function(e){
if(dragElement.gos!=true)
return;
var e=e||window.event;
$(drago).style.left=dragElement.l+e.clientX-dragElement.x+“px”;
$(drago).style.top=dragElement.t+e.clientY-dragElement.y+“px”;
}
$(ele).onmouseup=function(){
$(drago).style.filter=“alpha(opacity=”+100+”)”;
$(drago).style.opacity=1;
dragElement.gos=false;
}
......
}
theres some pics that show u the detail of this problem:
heres the panel’s normal state:
http://clip2net.com/clip/m3651/1212664842-clip-30kb.jpg

mousedown in firefox,this is what i want:
http://clip2net.com/clip/m3651/1212664886-clip-30kb.jpg

but this is what happens in ie7,the black border appears(but i didnt set the “border” attribute in css and js),its sucks:
http://clip2net.com/clip/m3651/1212664813-clip-36kb.jpg

and mouseup in firefox,return back to the normal staus,looks good:
http://clip2net.com/clip/m3651/1212664842-clip-30kb.jpg

mouseup in ie7, the black border still exist:
http://clip2net.com/clip/m3651/1212665678-clip-31kb.jpg

is this ie7 bug? why and how? thanx

Observing members: 0 Composing members: 0

7 Answers

Breefield's avatar

You might like Mootools.
It makes stuff like this a snap!

stephen's avatar

@breefield, yeah i know that javascript framework, but now i just wanna know what the problem is.

Breefield's avatar

But if you just ignore the problem you could have the thing working in 5 min with Mootools :p

stephen's avatar

Ignoring, Top suggestion! !

andthere's avatar

@stephen: hey.. were you able to solve your problem?
i am having the same issue when i try to modify the opacity.

Breefield's avatar

Just try setting the opacity like this, without the filter.

$(drago).style.opacity=0.7;

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther