图像/DIV 动画 +事件链
我正在努力制作我正在开发的网站所需的动画,我希望这里有人可以提供帮助。情况是这样的:客户希望网站的索引页面成为一个“保险库”,当单击“输入”链接时打开,并且它需要是一个非常具体的设计,我将尝试将其描述为“我是新人,无法发布图片。屏幕被垂直划分,左侧为 DIV-b,右侧为 DIV C。浮动在顶部的是 DIV-A,其中包含圆形图像,或者如果您愿意的话,也可以是保险库的锁。
#DIV-B {
position:relative;
top:0px;
width:50%;
float:left;
height:950px;
z-index:2;
background-image:url(../images/vault-bg-left.jpg);
background-position:right;
overflow:hidden;
}
#DIV-C {
position:relative;
top:0px;
width:50%;
float:right;
height:950px;
z-index:2;
background-image:url(../images/vault-bg-right.jpg);
background-position:left;
overflow:hidden;
}
#DIV-A {
position:relative;
top:150px;
margin:0 auto;
z-index:3;
margin:0 auto;
}
我已经将图像分解并正确对齐了 DIV;需要发生的是,当单击“输入”链接(在 DIV-A 中)时,DIV-A 中的图像(或 DIV 本身)将顺时针旋转 180 度,紧接着 DIV-A 和 DIV B 滑动向左滑动,DIV-C 向右滑动,露出下面的另一个 DIV(我猜是 D)。
我假设 jQuery 动画或者 Mootools 链接是可行的方法,但说实话,这种事情对我来说有点新鲜,所以我希望有人能够帮助我解决它。预先感谢您的任何帮助!
I'm struggling with an animation I need for the site I'm working on and I'm hoping that someone here can help. Here's the situation: the client wants the index page of the site to be a "vault" that opens up when the "enter" link is clicked, and it needs to be a very specific design which I'll try to describe as I'm new and can't post images. The screen is divided vertically with the left side being DIV-b and the right side being DIV C. Floating on top is DIV-A which contains a round image, or the lock of the vault, if you will.
#DIV-B {
position:relative;
top:0px;
width:50%;
float:left;
height:950px;
z-index:2;
background-image:url(../images/vault-bg-left.jpg);
background-position:right;
overflow:hidden;
}
#DIV-C {
position:relative;
top:0px;
width:50%;
float:right;
height:950px;
z-index:2;
background-image:url(../images/vault-bg-right.jpg);
background-position:left;
overflow:hidden;
}
#DIV-A {
position:relative;
top:150px;
margin:0 auto;
z-index:3;
margin:0 auto;
}
I've already got the image broken up and the DIVs aligned properly; what needs to happen is that when the "enter" link is clicked (in DIV-A), the image in DIV-A (or the DIV itself) will rotate 180 degrees degrees clockwise, followed immediately by DIV-A and DIV B sliding off to the left with DIV-C sliding off to the right, revealing another DIV (D, I guess) below that.
I'm assuming that jQuery animation and perhaps Mootools chaining is the way to go, but honestly this sort of thing is a bit new to me so I'm hoping that someone might be able to help me lay it out. Thanks in advance for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 jQuery 动画手动编写脚本,但这需要大量工作。幸运的是,市场上开始出现值得关注的 HTML5 动画创作工具。
http://labs.adobe.com/technologies/edge/
http://www.sencha.com/products/animator
You can script this by hand using jQuery animation, but it will be a lot of work. Fortunately HTML5 animation authoring tools are starting to appear on the market that are worth looking at.
http://labs.adobe.com/technologies/edge/
http://www.sencha.com/products/animator
我会使用 jQuery 和 CSS3 关键帧动画的组合...尽管它在 IE8 及以下版本中不起作用。我还没有测试过这个,但理论上它应该有效。如果需要修改请告诉我。
jQuery
解释:当您单击 ID 为“enter-link”的链接时,#DIV-A 中将添加一个“open-lock”类,它将随 CSS 旋转 180 度。该动画将持续 3 秒。同时设置了一个 setTimeout() 函数,时间为 3 秒,该函数将在旋转完成后立即执行。此函数向 DIV B 和 C 添加类,这将导致它们的相对位置发生变化,将它们滑出视口。
如果您希望不同的 DIV 的动画持续时间更长或更短,您可以在不同的 DIV 上设置单独的过渡属性。
如果您希望与旧版本的 Firefox 和 Safari 向后兼容,您也可以添加浏览器特定的前缀。 -moz-transition: 、 -webkit-transition: ,对于转换也是如此。
I would use a combination of jQuery and CSS3 keyframe animations... although it won't work in IE8 and under. I haven't tested this but in theory it should work. Let me know if it needs modification.
And the jQuery
Explanation: when you click the link with ID "enter-link", a class "open-lock" is added to #DIV-A which will rotate with CSS to 180 deg. This animation will take 3 seconds. Simultaneously a setTimeout() function has been set for 3 seconds, which will execute right after the rotation is complete. This function adds classes to DIVs B and C which will cause their relative positioning to change, sliding them out of the viewport.
You can set separate transition properties on the different DIVs if you want their animations to last longer or shorter.
You can add the browser specific prefixes as well if you want some backwards compatibility with older versions of firefox and safari. -moz-transition: , -webkit-transition: , and the same for transform.