javascript 打开信封动画html5或jquery

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23319393/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 00:43:14  来源:igfitidea点击:

Open envelope animation html5 or jquery

javascriptjquerycsshtml

提问by Tanker

I was looking for the forum or some other place to ask, so forgive me for posting this here...
I have been looking for an animation such as opening an envelope, not just shrink the image pretending that it opens.. and need something like this:
http://www.youtube.com/watch?v=PYX31NUbu2M
but I don't want a flash animation...
Click to open:
Envelope opens, pulls the "invitation", unfolds the "invitation" and stays on screen
Click to continue
Click to go back
Click to closed the envelope
All I was able to find was flash animation, I need it to be html, css, java or jquery... also I need some sort of flexibility for the width and height since I want to be able to use responsive media...

我一直在寻找的论坛或其他地方要问,所以请原谅我在这里张贴这......
我一直在寻找的动画,例如打开一个信封,而不只是缩小图像假装它打开..和需要的东西像这样:
http: //www.youtube.com/watch?v=PYX31NUbu2M
但我不想要flash动画...
点击打开:
信封打开,拉出“邀请”,展开“邀请”并停留在屏幕上
点击继续
点击返回
点击关闭信封
所有我能找到的是 flash 动画,我需要它是 html、css、java 或 jquery...我还需要某种宽度和灵活性高度,因为我希望能够使用响应式媒体...

If anyone knows of script that can do this please, share it, please point me in the right direction.

如果有人知道可以做到这一点的脚本,请分享,请指出正确的方向。

Thank you.

谢谢你。

回答by James Duffy

A Google search revealed this:

谷歌搜索揭示了这一点:

Demo and source: http://cssdeck.com/labs/animated-envelope

演示和来源:http: //cssdeck.com/labs/animated-envelope

HTML:

HTML:

<div id="bg"></div>
<div class="contact">
    <div class="envelope">
        <div class="top">
            <div class="outer"><div class="inner"></div></div>
        </div>
        <div class="bottom"></div>
        <div class="left"></div>
        <div class="right"></div>
        <div class="cover"></div>
        <div class="paper">
            <a class="call" href="tel:5555555555"><div class="i"></div>555 555 5555</a>
            <a class="mail" href="mailto:[email protected]"><div class="i">@</div>[email protected]</a>
        </div>
    </div>
</div>

CSS:

CSS:

#bg {
        position: absolute;
        left: 0px;
        top: 0px;
        height: 100%;
        width: 100%;
        background: #ffffff; background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPHJhZGlhbEdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iNzUlIj4KICAgIDxzdG9wIG9mZnNldD0iNDAlIiBzdG9wLWNvbG9yPSIjZmZmZmZmIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2JiYmJiYiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9yYWRpYWxHcmFkaWVudD4KICA8cmVjdCB4PSItNTAiIHk9Ii01MCIgd2lkdGg9IjEwMSIgaGVpZ2h0PSIxMDEiIGZpbGw9InVybCgjZ3JhZC11Y2dnLWdlbmVyYXRlZCkiIC8+Cjwvc3ZnPg==); background: -moz-radial-gradient(center, ellipse cover,  #ffffff 40%, #bbbbbb 100%); background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(40%,#ffffff), color-stop(100%,#bbbbbb)); background: -webkit-radial-gradient(center, ellipse cover,  #ffffff 40%,#bbbbbb 100%); background: -o-radial-gradient(center, ellipse cover,  #ffffff 40%,#bbbbbb 100%); background: -ms-radial-gradient(center, ellipse cover,  #ffffff 40%,#bbbbbb 100%); background: radial-gradient(ellipse at center,  #ffffff 40%,#bbbbbb 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#bbbbbb',GradientType=1 );
}
.contact {
        position: absolute;
        left: 50%;
        top: 50%;
        margin-left: -125px;
        margin-top: -125px;
        height: 250px;
        width: 250px;
        background: rgba(0, 0, 0, 0.1);

        border-radius: 2px;
        -ms-border-radius: 2px;
        -moz-border-radius: 2px;
        -o-border-radius: 2px;
        -webkit-border-radius: 2px;
}
.contact .envelope {
        position: absolute;
        height: 93px;
        width: 165px;
        left: 50%;
        margin-left: -83px;
        top: 50%;
        margin-top: -50px;
        background: #F9F9F9;

        transition: margin-top 300ms;
        -ms-transition: margin-top 300ms;
        -moz-transition: margin-top 300ms;
        -o-transition: margin-top 300ms;
        -webkit-transition: margin-top 300ms;
}
.contact:hover .envelope {
        transition-delay: 150ms;
        -ms-transition-delay: 150ms;
        -moz-transition-delay: 150ms;
        -o-transition-delay: 150ms;
        margin-top: -20px;
}    
.contact .envelope .top {
        position: absolute;
        top: -3px;
        left: 0px;
        width: 100%;
        height: 73px;
        z-index: 30;
        overflow: hidden;

        transform-origin: top;
        -ms-transform-origin: top;
        -moz-transform-origin: top;
        -o-transform-origin: top;
        -webkit-transform-origin: top;

        transition: transform 300ms 150ms, z-index 0ms 150ms, height 300ms 0ms, top 300ms 0ms;
        -ms-transition: -ms-transform 300ms 150ms, z-index 0ms 150ms, height 300ms 0ms, top 300ms 0ms;
        -moz-transition: -moz-transform 300ms 150ms, z-index 0ms 150ms, height 300ms 0ms, top 300ms 0ms;
        -o-transition: -o-transform 300ms 150ms, z-index 0ms 150ms, height 300ms 0ms, top 300ms 0ms;
        -webkit-transition: -webkit-transform 300ms 150ms, z-index 0ms 150ms, height 300ms 0ms, top 300ms 0ms;
}
.contact:hover .envelope .top {
        transition: transform 300ms 0ms, height 300ms 150ms, top 300ms 150ms;
        -ms-transition: -ms-transform 300ms 0ms, height 300ms 150ms, top 300ms 150ms;
        -moz-transition: -moz-transform 300ms 0ms, height 300ms 150ms, top 300ms 150ms;
        -o-transition: -o-transform 300ms 0ms, height 300ms 150ms, top 300ms 150ms;
        -webkit-transition: -webkit-transform 300ms 0ms, height 300ms 150ms, top 300ms 150ms;

        height: 10px;
        top: -60px;

        transform: rotateX(180deg);
        -ms-transform: rotateX(180deg);
        -moz-transform: rotateX(180deg);
        -o-transform: rotateX(180deg);
        -webkit-transform: rotateX(180deg);
}
.contact .envelope .outer {
        position: absolute;
        bottom: 0px;
        left: 0px;
        border-left: 83px solid transparent;
        border-right: 82px solid transparent;
        border-top: 70px solid #EEE;
}
.contact .envelope .outer .inner {
        position: absolute;
        left: -81px;
        top: -73px;
        border-left: 81px solid transparent;
        border-right: 80px solid transparent;
        border-top: 68px solid #333;
}
.contact .envelope .bottom {
        position: absolute;
        z-index: 20;
        bottom: 0px;
        left: 2px;
        border-left: 81px solid transparent;
        border-right: 80px solid transparent;
        border-bottom: 45px solid #333;
}    
.contact .envelope .left {
        position: absolute;
        z-index: 20; top: 0px;
        left: 0px;
        border-left: 81px solid #333;
        border-top: 45px solid transparent;
        border-bottom: 45px solid transparent;
}
.contact .envelope .right {
        position: absolute;
        z-index: 20;
        top: 0px;
        right: 0px;
        border-right: 80px solid #333;
        border-top: 45px solid transparent;
        border-bottom: 45px solid transparent;
}
.contact .envelope .cover {
        position: absolute;
        z-index: 15;
        bottom: 0px;
        left: 0px;
        height: 55%;
        width: 100%;
        background: #EEE;
}
.contact .envelope .paper {
        position: absolute;
        height: 83px;
        padding-top: 10px;
        width: 100%;
        top: 0px;
        left: 0px;
        background: #F9F9F9;
        z-index: 10;
        transition: margin-top 300ms 0ms;
        -ms-transition: margin-top 300ms 0ms;
        -moz-transition: margin-top 300ms 0ms;
        -o-transition: margin-top 300ms 0ms;
        -webkit-transition: margin-top 300ms 0ms;
}    
.contact:hover .envelope .paper {
        margin-top: -60px;
        transition: margin-top 300ms 150ms;
        -ms-transition: margin-top 300ms 150ms;
        -moz-transition: margin-top 300ms 150ms;
        -o-transition: margin-top 300ms 150ms;
        -webkit-transition: margin-top 300ms 150ms;
}    
.contact .envelope .paper a {
        position: relative;
        display: block;
        font-size: 14px;
        margin: 5px;
        margin-bottom: 0px;
        text-align: center;
        color: #333;
        text-decoration: none;
}    
.contact .envelope .paper a.call .i {
        position: absolute;
        top: 2px;
        left: 20px;
        display: inline-block;
        width: 3px;
        height: 5px;
        border-width: 5px 0 5px 2px;
        border-style: solid;
        border-color: #555;
        background: transparent;

        transform: rotate(-30deg);
        -ms-transform: rotate(-30deg);
        -moz-transform: rotate(-30deg);
        -o-transform: rotate(-30deg);
        -webkit-transform: rotate(-30deg);

        border-top-left-radius: 3px 5px;
        border-bottom-left-radius: 3px 5px;
        -moz-border-radius-topleft: 3px 5px;
        -moz-border-radius-bottomleft: 3px 5px;
        -webkit-border-top-left-radius: 3px 5px;
        -webkit-border-bottom-left-radius: 3px 5px;

        transition: border-color 300ms;
        -ms-transition: border-color 300ms;
        -moz-transition: border-color 300ms;
        -o-transition: border-color 300ms;
        -webkit-transition: border-color 300ms;
}    
.contact .envelope .paper a {
        color: #333;

        transition: color 200ms;
        -ms-transition: color 200ms;
        -moz-transition: color 200ms;
        -o-transition: color 200ms;
        -webkit-transition: color 200ms;
}    
.contact .envelope .paper a:hover {
        color: #EEE;
}    
.contact .envelope .paper a.call:hover .i {
        border-color: #DDD;
}    
.contact .envelope .paper a.mail .i {
        position: absolute;
        top: 0px;
        left: 17px;
        display: inline-block;
        font-size: 13px;
        font-weight: bold;
}