当前位置:主页 > 网页特效 > 手风琴代码 >

Bootstrap垂直手风琴折叠菜单特效

发布时间:2018/06/28 来源:互联网 浏览: 关键词:bootstrap 手风琴 
Bootstrap垂直手风琴折叠菜单特效 Bootstrap垂直手风琴折叠菜单特效
阿里云

简要教程

这是一款效果非常炫酷的Bootstrap垂直手风琴折叠菜单特效。在该bootstrap垂直手风琴折叠菜单中,每个菜单项通过css3阴影制作出带立体感觉的纸张效果,非常炫酷。

使用方法

在页面中引入jquery和bootstrap相关文件,以及fontawsome字体图标文件。。

<linkhref="css/bootstrap.min.css"rel="stylesheet">
<linkhref="css/font-awesome.min.css"rel="stylesheet">
<scriptsrc="jquery.min.js"></script>
<scriptsrc="bootstrap.min.js"></script>

HTML结构

该Bootstrap垂直手风琴折叠菜单的HTML结构如下。

<divclass="container">
    <divclass="row">
        <divclass="col-md-6">
            <divclass="panel-group"id="accordion"role="tablist"aria-multiselectable="true">
                <divclass="panel panel-default">
                    <divclass="panel-heading"role="tab"id="headingOne">
                        <h4class="panel-title">
                            <arole="button"data-toggle="collapse"data-parent="#accordion"href="#collapseOne"aria-expanded="true"aria-controls="collapseOne">
                                <iclass="icon fa fa-globe"></i>
                                Section 1
                            </a>
                        </h4>
                    </div>
                    <divid="collapseOne"class="panel-collapse collapse in"role="tabpanel"aria-labelledby="headingOne">
                        <divclass="panel-body">
                            <p>Lorem ipsum dolor sit amet...</p>
                        </div>
                    </div>
                </div>
                <divclass="panel panel-default">
                    <divclass="panel-heading"role="tab"id="headingTwo">
                        <h4class="panel-title">
                            <aclass="collapsed"role="button"data-toggle="collapse"data-parent="#accordion"href="#collapseTwo"aria-expanded="false"aria-controls="collapseTwo">
                                <iclass="icon fa fa-briefcase"></i>
                                Section 2
                            </a>
                        </h4>
                    </div>
                    <divid="collapseTwo"class="panel-collapse collapse"role="tabpanel"aria-labelledby="headingTwo">
                        <divclass="panel-body">
                            <p>Lorem ipsum dolor sit amet...</p>
                        </div>
                    </div>
                </div>
                <divclass="panel panel-default">
                    <divclass="panel-heading"role="tab"id="headingThree">
                        <h4class="panel-title">
                            <aclass="collapsed"role="button"data-toggle="collapse"data-parent="#accordion"href="#collapseThree"aria-expanded="false"aria-controls="collapseThree">
                                <iclass="icon fa fa-mobile"></i>
                                Section 3
                            </a>
                        </h4>
                    </div>
                    <divid="collapseThree"class="panel-collapse collapse"role="tabpanel"aria-labelledby="headingThree">
                        <divclass="panel-body">
                            <p>Lorem ipsum dolor sit amet...</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>      

CSS样式

然后为该Bootstrap垂直手风琴折叠菜单添加下面的CSS样式,对其进行美化。

a:hover,a:focus{
    text-decoration:none;
    outline:none;
}
#accordion .panel{
    border:none;
    border-radius:0;
    box-shadow:none;
    margin:0010px;
    overflow:hidden;
    position:relative;
}
#accordion .panel-heading{
    padding:0;
    border:none;
    border-radius:0;
    margin-bottom:10px;
    z-index:1;
    position:relative;
}
#accordion .panel-heading:before,
#accordion .panel-heading:after{
    content:"";
    width:50%;
    height:20%;
    box-shadow:015px5pxrgba(0,0,0,0.4);
    position:absolute;
    bottom:15px;
    left:10px;
    transform:rotate(-3deg);
    z-index:-1;
}
#accordion .panel-heading:after{
    left:auto;
    right:10px;
    transform:rotate(3deg);
}
#accordion .panel-title a{
    display:block;
    padding:15px70px15px70px;
    margin:0;
    background:#fff;
    font-size:18px;
    font-weight:700;
    letter-spacing:1px;
    color:#d11149;
    border-radius:0;
    box-shadow:01px4pxrgba(0,0,0,0.1),0040pxrgba(0,0,0,0.1)inset;
    position:relative;
}
#accordion .panel-title a:before,
#accordion .panel-title a.collapsed:before{
    content:"\f106";
    font-family: fontawesome;
    width:55px;
    height:100%;
    text-align:center;
    line-height:50px;
    border-left:2pxsolid#D11149;
    position:absolute;
    top:0;
    right:0;
}
#accordion .panel-title a.collapsed:before{content:"\f107"; }
#accordion .panel-title a .icon{
    display:inline-block;
    width:55px;
    height:100%;
    border-right:2pxsolid#d11149;
    font-size:20px;
    color: rgba(0,0,0,0.7);
    line-height:50px;
    text-align:center;
    position:absolute;
    top:0;
    left:0;
}
#accordion .panel-body{
    padding:10px20px;
    margin:0020px;
    border-bottom:3pxsolid#d11149;
    border-top:none;
    background:#fff;
    font-size:15px;
    color:#333;
    line-height:27px;
}

共有人阅读,期待你的评论!评论
Top