scss 使用IE 8支持动画/转换菜单

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss 使用IE 8支持动画/转换菜单相关的知识,希望对你有一定的参考价值。

# an animatable menu with gracefull IE 8 support

long story short: 

- you can easily animate/transition the `height` and also the `opacity` of the menu, which gives it a nice _fade'n'slide_ entrance.
- IE does not understand transitions or opacity, and depending on your setup, just the `height: 0` wouldn't suffice (i.e. when you have negative margins…), so we go for `visibility` here, which does the – non animated – trick.
- you absoluteley _need_ to do transition on `visibility` as well, otherwise the menu would just _pop_ in or out of view.
- if you _do not_ need to support IE 8, then forget about `visibility`, as IE 9 understands `opacity`, but doesn't understand transitions – which is fine.
$( ".your-button-class" ).bind( "click", function( event ) {
	$( ".your-menu-class" ).toggleClass( 'isVisible' );
});
.your-menu-class {
	height: 0;
	margin-bottom: 32px;
	margin-top: -8px;
	opacity: 0;
	position: relative;
	transition: height 0.7s ease-in-out, opacity 0.7s ease-in-out, visibility 0.7s ease-in-out;
	visibility: hidden; // used by IE
	width: 100%;

	&.isVisible {
		height: 114px;
		opacity: 1;
		visibility: visible; // used by IE
	}

以上是关于scss 使用IE 8支持动画/转换菜单的主要内容,如果未能解决你的问题,请参考以下文章

scss Mixin用于使用flexbox制作漂亮的水平菜单。那是什么?您希望浏览器支持不支持的糟糕IE版本

Internet Explorer 8 及更低版本的 SVG 支持

scss Opacity Mixin(SCSS)[...支持IE8]

scss 使用Breakpoint +指南针/支持处理IE8及更低版本

scss 使用Breakpoint +指南针/支持处理IE8及更低版本

Ionic 2 动画(使用 Angular2)=> 来自 variable.scss 的颜色,“无法在“元素”上执行“动画”:不支持部分关键帧