通用的CCS3代碼

<!docytpe html>
<html>
<head>
<style type="text/css" id="CSS3">
img:hover{
transition-property:transform;
transition-duration:0.2s;
transform:scale(2,2);
transform-origin:0 0;
}
</style>
<script>
"use strict";
(function(){
var ss=document.getElementById('CSS3');
var re=/transition|transform/g;
var prefix=window.navigator.userAgent.match(/Firefox|WebKit|Opera|MSIE/);
prefix=prefix?{Firefox:"-moz-",WebKit:"-webkit-",Opera:"-o-",MSIE:"-ms-"}[prefix[0]]:"";
if (prefix=="-ms-"){
ss.styleSheet.cssText=ss.innerHTML.replace(re,function(s){return prefix+s});
} else ss.firstChild.data=ss.firstChild.data.replace(re,function(s){return prefix+s});
})();
</script>
</head>
<body>
<img src="http://images.cnblogs.com/logo_small.gif"></img>
</body>
</html>
posted @ 2011-09-20 22:59  simonleung  阅读(365)  评论(0)    收藏  举报