×

推荐一个简单的酷炫导航

作者:andy0012017.01.06来源:Web前端之家浏览:15917评论:0
关键词:导航html

推荐一个简单的酷炫导航

<!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.0,maximum-scale=1.0,user-scalable=0">
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <title>首页</title>
</head>
<style>
body,
p,
ul,
h1,
h2,
h3,
h4,
h5,
h6,
ol,
dd,
dl,
input,
li,
span {
    margin: 0;
    padding: 0;
    list-style: none;
    font-weight: normal;
    -webkit-tap-highlight-color: rgba(0,0,0,0);/*清除默认点击闪动效果*/
}
span{
    display:inline-block;
}
i{
    font-style:normal;
}
a {
    text-decoration: none;
    color: inherit;
}
body {
  font: 10px / 1.14 "Microsoft YaHei","Helvetica Neue",Helvetica,Arial,sans-serif;
  /*font: 10px / 1.14 effra,Helvetica,Arial,sans-serif;*/
  color:#333;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -moz-font-feature-settings: 'liga', 'kern';
    /*消除文字锯齿*/
}
html{font-size:10px}/*默认配置*/
@media screen and (min-width:321px) and (max-width:375px){html{font-size:11px}}
@media screen and (min-width:376px) and (max-width:414px){html{font-size:12px}}
@media screen and (min-width:415px) and (max-width:639px){html{font-size:15px}}
@media screen and (min-width:640px) and (max-width:719px){html{font-size:20px}}
@media screen and (min-width:720px) and (max-width:749px){html{font-size:22.5px}}
@media screen and (min-width:750px) and (max-width:799px){html{font-size:23.5px}}
@media screen and (min-width:800px){html{font-size:25px}}
.clearfix:after {
    content: ".";
    display: block;
    height: 0;
    visibility: hidden;
    clear: both;
}
.clearfix {
    *zoom: 1;
}
.nav{
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    display: none;
    overflow: hidden;
    z-index:2;
}
.nav:before{
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: #333;
    opacity:.5;
    z-index: -1;
}
.nav>ul{
    position: absolute;
    width: 100%;
    height: 100%;
}
.nav>ul>li{
    float: left;
    width: 25%;
    height: 100%;
    transition: all .2s;
    position: relative;
    cursor: pointer;
    display: block;
    background: #2c3739;
}
.nav>ul>li:nth-child(2n){
    top: -100%;
}
.nav>ul>li:nth-child(2n+1){
    top: 100%;
}
.nav>ul>li:before{
    content: '';
    position: absolute;
    width: 2px;
    height: 100%;
    background: #fb565e;
    left: 0;
    transform: rotate(10deg);
}
.nav>ul>li:first-of-type:before{
    width: 0;
}
.nav>ul>li:last-of-type{
    border-right: 0;
}
.nav>ul>li.open{
    width: 58%;
}
.nav>ul>li.hide{
    width: 14%;
}
.nav .nav-inner{
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    vertical-align: middle;
    text-align: center;
    color: #007aff;
}
.nav .nav-inner>span{
   position: absolute;
    top: 45%;
    left: 40%;
    background:#fff;
    width: 3rem;
    height: 3rem;
    border-radius: .3rem;
}
.nav .nav-inner>span:before{
    font-size: 3rem;
}
.nav>ul>li.open .nav-inner>span{
    left: 20%;
    top: 30%;
}
.nav>ul>li.open .nav-inner>span:before{
    font-size: 4rem;
}
.nav>ul>li.open .nav-inner>h3{
    display: block;
    position: absolute;
    font-size: 40px;
    color: #fb565e;
    top: 33%;
    left: 50%;
}
.nav>ul>li .nav-inner>h3{
    display: none;
}
.nav>ul>li.open .nav-inner>p{
    font-size: 20px;
    color: #fff;
    text-align: center;
    position: relative;
    left: 0;
    padding:0 100px;
    line-height: 1.5;
    top: 51%;
}
.nav>ul>li .nav-inner>p{
    display: none;
}
/*banner*/
.banner{
    width: 100%;
    height: 100%;
    position: absolute;
    z-index:1;
    padding: 10px;
    font-size:3rem;
    background: url("../images/banner-02.jpg") no-repeat center center;
    background-size: cover;
}
</style>
<body>
<div>
    <div>
homepage (click)
    </div>
    <div>
        <ul id="navs">
            <li>
                <div>
                    <span></span>
                    <h3>alarm</h3>
                    <p>Zero is the first banking experience to combine debit-style functionality and credit card rewards. Powered by a solid metal card called Zerocard and the Zero app, Zero gives customers 3.0% cash back on purchases and has none of the fees traditional banks charge.</p>
                </div>
            </li>
            <li>
                <div>
                    <span></span>
                    <h3>audio</h3>
                    <p>balabala xiaomoxian</p>
                </div>
            </li>
            <li>
                <div>
                    <span></span>
                    <h3>contacts</h3>
                    <p>bilibili</p>
                </div>
            </li>
            <li>
                <div>
                    <span></span>
                    <h3>share</h3>
                    <p>hello word!</p>
                </div>
            </li>
        </ul>
    </div>
</div>
</body>
</html>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script>
    $(document).ready(function () {
        function navIndex(){
            setTimeout(function(){
                $(document).on('mouseover mouseleave','#navs>li',function(e){
                    if(e.type=='mouseover'){
                        $(this).addClass('open').siblings().addClass('hide');
                        $(this).find('p').stop().fadeIn();
                    }else if(e.type=='mouseleave'){
                       $(this).removeClass('open').siblings().removeClass('hide');
                       $(this).find('p').hide();
                    }
                });
            },500)
        }
        $(document).on('click','.banner',function(){
            $('.nav').show().find('li').each(function(e,i){
                $(i).animate({'top':0},e*100,function(){
                    navIndex()
                })
            })
        })
    });
</script>

您的支持是我们创作的动力!
温馨提示:本文作者系 ,经Web前端之家编辑修改或补充,转载请注明出处和本文链接:
https://www.jiangweishan.com/article/biji013.html

网友评论文明上网理性发言 已有0人参与

发表评论: