Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运用js实现透明度变化(opacity.html文件) #4

Open
zlluGitHub opened this issue Apr 10, 2018 · 0 comments
Open

运用js实现透明度变化(opacity.html文件) #4

zlluGitHub opened this issue Apr 10, 2018 · 0 comments

Comments

@zlluGitHub
Copy link
Owner

  • 透明度由0.3到1缓慢变化:
 window.onload=function(){
	   var oDiv=document.getElementById('id1');
	   oDiv.onmouseover=function(){  //鼠标经过时执行
	  	startMove1(100);
	  	}
	   oDiv.onmouseout=function(){   //鼠标离开时执行
	  	startMove1(30);
	  	}
	}
  • opacity不透明属性总结:

    Css3 opacity透明度设置,所有主流浏览器都支持opacity属性。

    IE8和早期版本支持另一种过滤器属性。像:filter:Alpha(opacity=50),早期全兼容写法:

    .style {          
       filter:alpha(opacity=50);          
       -moz-opacity:0.5;          
       -khtml-opacity: 0.5;          
       opacity: 0.5;     
    } 

从Firefox3.5+不再支持私有属性-moz-opacity,IE9+才开始支持CSS3 opacity,而对IE6-IE8我们习惯使用filter滤镜属性来进行实现。

     opacity{
      opacity: 0.3;
       filter:alpha(opacity=30);  //filter 过滤器   兼容IE678
     }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant