如何使用jqueryrain菜单?

时间:2017-05-16 13:09:02

标签: javascript jquery html

我正在尝试将此菜单http://jqueryrain.com/tutorial/menu/demo7/添加到我的项目中,但是当光标不在圆圈上时,li项目就会消失。 除此之外我删除了一些图标,所以我只有4个li项目。如何安排它们以便它们相对于圆圈是对称的。 我将感谢你的帮助。 谢谢 这是图片: menu

1 个答案:

答案 0 :(得分:0)

您只需要更改旋转值。



.demo{
    background: #99b977;
    transform: translate3d(0, 0, 0);
}
.navbar{
    width: 150px;
    height: 150px;
    line-height: 150px;
    border-radius: 50%;
    background: #fff;
    margin: 70px auto;
    position: relative;
    cursor: pointer;
    text-align: center;
    font-size: 2.75em;
    font-weight: bold;
    color: #99b977;
    transition: 0.24s 0.2s;
}
.navbar:hover{
    background: rgba(255, 255, 255, 0.75);
}
.navbar .menu{
    list-style: none;
    padding: 10;
    margin: 0;
    position: absolute;
    top: -75px;
    left: -75px;
    border: 150px solid transparent;
    cursor: default;
    border-radius: 50%;
    transform: scale(0);
    transition: transform 1.4s 0.07s;
    z-index: -1;
}
.navbar:hover .menu{
    transition: transform 0.4s 0.08s, z-index   0s  0.5s;
    transform: scale(1);
    z-index: 1;
}
.navbar .menu li{
    position: absolute;
    top: -100px;
    left: -100px;
    transform-origin: 100px 100px;
    transition: all 0.5s 0.1s;
}
.navbar:hover .menu li{
    transition: all 0.6s;
}
.navbar .menu li a{
    width: 45px;
    height: 45px;
    line-height: 45px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    font-size: 60%;
    color: #99b977;
    transition: 0.6s;
}
.navbar:hover .menu li:nth-child(1){
    transition-delay: 0.02s;
    transform: rotate(45deg);
}
.navbar:hover .menu li:nth-child(1) a{
    transition-delay: 0.04s;
    transform: rotate(315deg);
}
.navbar:hover .menu li:nth-child(2){
    transition-delay: 0.04s;
    transform: rotate(125deg);
}
.navbar:hover .menu li:nth-child(2) a{
    transition-delay: 0.08s;
    transform: rotate(595deg);
}
.navbar:hover .menu li:nth-child(3){
    transition-delay: 0.06s;
    transform: rotate(165deg);
}
.navbar:hover .menu li:nth-child(3) a{
    transition-delay: 0.12s;
    transform: rotate(555deg);
}
.navbar:hover .menu li:nth-child(4){
    transition-delay: 0.08s;
    transform: rotate(205deg);
}
.navbar:hover .menu li:nth-child(4) a{
    transition-delay: 0.16s;
    transform: rotate(515deg);
}

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Menu Style : Demo 7</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
   <link rel="stylesheet" href="style.css"/>
  </head>
  <body>
    <div class="demo">
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <div class="navbar">MENU
                        <ul class="menu">
                            <li><a href="#" class="fa fa-facebook"></a></li>
                            <li><a href="#" class="fa fa-google-plus"></a></li>
                            <li><a href="#" class="fa fa-twitter"></a></li>
                            <li><a href="#" class="fa fa-linkedin"></a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
  </body>
</html>
&#13;
&#13;
&#13;

使用facebook图标,我更改了li的旋转值。

.navbar:hover .menu li:nth-child(1){
    transition-delay: 0.02s;
    transform: rotate(45deg);
}

更改此值后,您必须更改图标的旋转值

.navbar:hover .menu li:nth-child(1) a{
    transition-delay: 0.04s;
    transform: rotate(315deg);
}

我让你完成。