简体   繁体   English

CSS / JQUERY翻转过渡效果改变方向

[英]CSS/JQUERY flip transition effect change direction

currently the transition slides from left to right. 目前,过渡从左到右滑动。 And idea how I would make it appear that it goes from top to bottom? 并想知道如何让它看起来从上到下?

Here is the code: http://jsfiddle.net/lakario/VPjX9/ 这是代码: http//jsfiddle.net/lakario/VPjX9/

Here is some of the css code: 这是一些css代码:

.flip {
    -webkit-backface-visibility:hidden;
    -webkit-transform:translateX(0); 
    -moz-backface-visibility:hidden;
    -moz-transform:translateX(0);
}
.flip.in.reverse {
    -webkit-animation-name: flipintoleft;
    -moz-animation-name: flipintoleft;
}
@-webkit-keyframes flipouttoleft {
    from { -webkit-transform: rotateY(0); }
    to { -webkit-transform: rotateY(-90deg) scale(.9); }
}
@-moz-keyframes flipouttoleft {
    from { -moz-transform: rotateY(0); }
    to { -moz-transform: rotateY(-90deg) scale(.9); }
}
@-webkit-keyframes flipouttoright {
    from { -webkit-transform: rotateY(0) ; }
    to { -webkit-transform: rotateY(90deg) scale(.9); }
}
@-moz-keyframes flipouttoright {
    from { -moz-transform: rotateY(0); }
    to { -moz-transform: rotateY(90deg) scale(.9); }
}
@-webkit-keyframes flipintoleft {
    from { -webkit-transform: rotateY(-90deg) scale(.9); }
    to { -webkit-transform: rotateY(0); }
}
@-moz-keyframes flipintoleft {
    from { -moz-transform: rotateY(-90deg) scale(.9); }
    to { -moz-transform: rotateY(0); }
}
@-webkit-keyframes flipintoright {
    from { -webkit-transform: rotateY(90deg) scale(.9); }
    to { -webkit-transform: rotateY(0); }
}
@-moz-keyframes flipintoright {
    from { -moz-transform: rotateY(90deg) scale(.9); }
    to { -moz-transform: rotateY(0); }
}

Here you go! 干得好!

http://jsfiddle.net/VPjX9/289/ http://jsfiddle.net/VPjX9/289/

I'm sure there's a cleaner way to do it, but I just changed the rotate Y values in your CSS to rotate X, so it's along the X axis. 我确信有一个更简洁的方法,但我只是改变CSS中的旋转Y值来旋转X,所以它沿着X轴。

Example: Was: 示例:是:

@-moz-keyframes flipintoleft {
from { -moz-transform: rotateX(-90deg) scale(.9); }
to { -moz-transform: rotateY(0); }}

Now is: 现在是:

@-moz-keyframes flipintoleft {
from { -moz-transform: rotateX(-90deg) scale(.9); }
to { -moz-transform: rotateY(0); }}

Instead of using rotateY , use rotateX , which will fix the axis horizontally, instead of vertically. 代替使用rotateY ,使用rotateX ,这将水平固定的,而不是垂直的轴。

Example: http://jsfiddle.net/VPjX9/287/ 示例: http//jsfiddle.net/VPjX9/287/

If you want it to rotate the other way, just switch -90deg for 90deg and vice versa. 如果你想让它以另一种方式旋转,只需将-90deg切换为90deg,反之亦然。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM