首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >onHover的逆向动画

onHover的逆向动画
EN

Stack Overflow用户
提问于 2015-07-16 09:54:18
回答 1查看 90关注 0票数 0

我使用CSS动画作为我的主页。由于没有与onHover相反的地方,所以我尝试了

但这对我没什么用。

见:

fiddlehttps://jsfiddle.net/mus8sdL0/

谢谢你的帮助

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-07-16 10:07:25

试试这个..。

HTML

代码语言:javascript
复制
<section class="half">
  <div id="containertop">
  <div class="titletextup">
    UP 
    <br>
    <div id="triangle-facing-top"></div>
  </div> 
  </div>
</section>

<section class="half">
  <div class="titletextdown">
    <div id="triangle-facing-bottom"></div>
    <br>
    DOWN 
  </div>
</section>

CSS

代码语言:javascript
复制
@charset "UTF-8";
* {
    margin: 0; padding: 0;
}

html, body, #container {
    height: 100%;
    font-family: 'corbertregular', arial, sans-serif;
    font-size:24px;
    color:white;
}
header {
    height: 50px;
    background: gray;
}
main {
    height: calc(100% - 50px);
    background: green;
}
.half {
    height: 50%;
    position: relative;
}
.half:first-child {

    border-bottom:10px;
    border-left:0px;
    border-right:0px;
    border-top:0px;
    border-bottom-color:white;
    border-style:solid;
}

#containertop {
    background: blue;
    height: 100%;
}

.half:first-child > #containertop{
    position:absolute;
    z-index:1;
    width:100%;
    top:0px;
    transition: 2s all ease;
}

.half:first-child:hover > #containertop{
    top: -100%;
}

.half:last-child {
    background: green;
    border-top:10px;
    border-bottom:0px;
    border-left:0px;
    border-right:0px;
    border-top-color:white;
    border-style:solid;
}

.titletextup{
  text-align:center;
}

.titletextdown{
 text-align:center;
}

#triangle-facing-top {
    display: inline-block;
    margin: 72px;
    border-right: 24px solid; border-bottom: 24px solid;
    width: 120px; height: 120px;
    transform: rotate(-135deg);
    display: inline-block;
   -webkit-transform:rotate(-135deg);
   -moz-transform:rotate(-135deg);
   -o-transform:rotate(-135deg);
   color: white;
}

#triangle-facing-bottom {
    display: inline-block;
    margin: 72px;
    border-right: 24px solid; border-bottom: 24px solid;
    width: 120px; height: 120px;
    transform: rotate(45deg);
    display: inline-block;
   -webkit-transform:rotate(45deg);
   -moz-transform:rotate(45deg);
   -o-transform:rotate(45deg);
   color:white;
}

看看这个小提琴

用于底部和顶部animation 看看这把小提琴

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31450960

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档