首页 > 其他 > 详细

在chrome中通过getComputedStyle()获取透明度的问题

时间:2015-05-05 16:48:02      阅读:281      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>
	<head>
	<style>
	img{
	width:100px;
	height:100px;
	filter:alpha(opacity:94);
	opacity:0.94;
}
	</style>
	<script>
	window.onload=function(){
	var oImg=document.getElementById(‘img1‘);
	alert(getComputedStyle(oImg,false).opacity);
}
	</script>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>RunJS</title>
	</head>
	<body>
	<div>
		<img id=‘img1‘ src=‘http://sandbox.runjs.cn/uploads/rs/60/vnrn5xjh/uuu.jpg‘/>
		</div>
	</body>
</html>

在chrome下弹出

技术分享

而  IE9/Firefox/Safari/Opera 弹出的分别是0.94

jQuery的css方法也存在这个问题。 注意!

参考:http://www.cnblogs.com/snandy/archive/2011/07/27/2118441.html

在chrome中通过getComputedStyle()获取透明度的问题

原文:http://onthecloud.blog.51cto.com/7312338/1642094

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!