当前位置: 编程技术>WEB前端
兼容多浏览器实现半透明(Opera ie firefox)
来源: 互联网 发布时间:2014-09-06
本文导语: Click on a link above to make the image disappear and re-appear by gradually fading in/out. It uses CSS transparency, in CSS you can set the transparency in different ways. To ensure that it works on most browsers we use all three. opacity: 0.5; This one...
Click on a link above to make the image disappear and re-appear by gradually fading in/out. It uses CSS transparency, in CSS you can set the transparency in different ways. To ensure that it works on most browsers we use all three.
opacity: 0.5;
This one is the official CSS3 method, at the moment it works in newer Mozilla versions.
-moz-opacity: 0.5;
This one works in older versions of Mozilla and Phoenix/FireBird/FireFox.
-khtml-opacity: 0.5;
This is used by browsers that use teh KHTML rendering engine, namely Konquerer on Linux and Safari on MacOS.
filter: alpha(opacity=50);
This one works only in MSIE.
There is actually another one: -khtml-opacity: 0.5; works for the browsers Konquerer on Linux and Safari on MacOS. You could add it too if you want to support these users. Somewhere in the near future most browsers will support CSS3 and opacity: 0.5; should work everywhere.
function opacity(id, opacStart, opacEnd, millisec) {
//speed for each frame
var speed = Math.round(millisec / 100);
var timer = 0;
//determine the direction for the blending, if start and end are the same nothing happens
if(opacStart > opacEnd) {
for(i = opacStart; i >= opacEnd; i--) {
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
timer++;
}
} else if(opacStart
通过javascript实现DIV居中,兼容各浏览器版本
CSS hack浏览器兼容一览表
JSP中用回车监听按钮事件兼容火狐 IE等主流浏览器
处理CSS3跨浏览器兼容的工具 Prefixr
Iframe自适应高度兼容ie,firefox多浏览器
都是IE惹的祸多浏览器兼容问题
php文件下载代码(多浏览器兼容、支持中文文件名)
兼容ie6浏览器的php下载文件代码分享
在到达无H无F境界前~还是要痛苦~我兼容浏览器的CSS
不用js多浏览器兼容纯DIV/CSS对联漂浮广告代码
多浏览器css兼容分析小结
jquery禁用右键、文本选择功能、复制按键的代码(兼容多浏览器)
jQuery.event兼容各浏览器的event详细解析
jQuery右下角弹出广告代码兼容多浏览器
php下载文件代码(兼容ie6浏览器)
jquery div拖拽效果(兼容浏览器)
css浏览器不兼容原因分析及解决办法第1/2页
css实现兼容各个浏览器的技巧的代码
Css浏览器兼容的解决方法
Web系统通过EXE文件实现读取客户电脑MAC等硬件信息且兼容非IE浏览器
opacity: 0.5;
This one is the official CSS3 method, at the moment it works in newer Mozilla versions.
-moz-opacity: 0.5;
This one works in older versions of Mozilla and Phoenix/FireBird/FireFox.
-khtml-opacity: 0.5;
This is used by browsers that use teh KHTML rendering engine, namely Konquerer on Linux and Safari on MacOS.
filter: alpha(opacity=50);
This one works only in MSIE.
There is actually another one: -khtml-opacity: 0.5; works for the browsers Konquerer on Linux and Safari on MacOS. You could add it too if you want to support these users. Somewhere in the near future most browsers will support CSS3 and opacity: 0.5; should work everywhere.
代码如下:
function opacity(id, opacStart, opacEnd, millisec) {
//speed for each frame
var speed = Math.round(millisec / 100);
var timer = 0;
//determine the direction for the blending, if start and end are the same nothing happens
if(opacStart > opacEnd) {
for(i = opacStart; i >= opacEnd; i--) {
setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
timer++;
}
} else if(opacStart