为悬停时的主菜单项设置翻转动画

set flip animation for main menu item on hover

我有一个演示网站。如何获得下面给出的参考网站中的菜单悬停效果。我摆弄了一点 here,但是当我将鼠标悬停在菜单项上时我没有得到过渡

ref 站点:- 单击 here

将鼠标悬停在顶部菜单上,查看效果。我如何获得这种效果?

查看代码直到我完成

HTML

<li>
    <div class="header-navigation-item-state-wrapper">
        <div class="white">
                <h4 class="header-white">Collections</h4>

        </div>
        <div class="black">
                <h4 class="header-black">Collections</h4>

        </div>
    </div>
</li>

CSS

* {
    background:yellow
}
li {
    list-style:none;
}
.header-black {
    background:#000;
    color:#fff;
    padding:10px;
    display:block
}
.black {
    display:none;
}
.header-white {
    background:#fff;
    color:#000;
    padding:10px;
    display:block
}

JQuery

$(document).ready(function () {
    $("li").mouseenter(function () {
        $(".white").css('display', 'none');
        $(".black").css('display', 'block');
    });
    $("li").mouseleave(function () {
        $(".white").css('display', 'block');
        $(".black").css('display', 'none');
    });
})

您可以按照以下方式使用3d效果。

.menu li {
 display: inline-block;
}

.menu li a {
 color: #fff;
 display: block;
 text-decoration: none;
 overflow: visible;
 line-height: 20px;
 font-size: 24px;
 padding: 15px 10px;
}

/* animation domination */
.threed {
 perspective: 200px;
 transition: all .07s linear;
 position: relative;
 cursor: pointer;
}
 /* complete the animation! */
 .threed:hover .box, 
 .threed:focus .box {
  transform: translateZ(-25px) rotateX(90deg);
 }

.box {
 transition: all .3s ease-out;
 transform: translatez(-25px);
 transform-style: preserve-3d;
 pointer-events: none;
 position: absolute;
 top: 0;
 left: 0;
 display: block;
 width: 100%;
 height: 100%;
}

.white {
 transform: rotatex(0deg) translatez(25px);
    background: white;
    color: black;
}

.black {
 transform: rotatex(-90deg) translatez(25px);
 color: white;
    background: black;
}

.white, .black {
 display: block;
 width: 100%;
 height: 100%;
 position: absolute;
 top: 0;
 left: 0;
 padding: 15px 10px;
 pointer-events: none;
 box-sizing: border-box;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<ul class="menu">
 <li><a href="/" class="threed">
  Home
  <span class="box">
   <span class="white">Home</span>
   <span class="black">Home</span>
  </span>
 </a></li>
</ul>

您可以根据您的要求进行更改。
希望对你有帮助。