css+js实现垂直图标伸缩菜单导航条效果代码

代码语言:html

所属分类:菜单导航

代码描述:css+js实现垂直图标伸缩菜单导航条效果代码

代码标签: css js 垂直 图标 伸缩 菜单 导航条

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
<style>
    *
{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}
body
{
  min-height: 100vh;
  background: #232c33;
  display: flex;
  justify-content: center;
  align-items: center;
}
.navigation
{
  position: relative;
  height: 500px;
  width: 70px;
  box-sizing: initial;
  border-left: 10px solid #2b343b;
  box-shadow: 10px 0 0 #4187f6;
  background: #2b343b;
  transition: width 0.5s;
  overflow-x: hidden;
}
.navigation:hover
{
  width: 300px;
}
.navigation ul
{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding-left: 5px;
  padding-top: 40px;
}
.navigation ul li
{
  position: relative;
  list-style: none;
  width: 100%;
  border-top-left-radius: 20px;
  border-bottom-left-radius: 20px;
}
.navigation ul li.active 
{
  background: #4187f6;
}
.navigation ul li a
{
  position: relative;
  display: block;
  width: 100%;
  display: flex;
  text-decoration: none;
  color: #fff;
}
.navigation ul li.active a
{
  color: #fff;
}
.navigation ul li.active a::before
{
  content: '';
  position: absolute;
  top: -30px;
  right: 0;
  width: 30px;
  height: 30px;
  background: #2b343b;
  border-radius: 50%;
  box-shadow: 15px 15px 0 #4187f6;
}
.navigation ul li.active a::after
{
  content: '';
  position: absolute;
  bottom: -30px;
  right: 0;
  width: 30px;
  height: 30px;
  background: #2b343b;
  border-radius: 50%;
  box-shadow: 15px -15px 0 #4187f6;
}
.navigation ul li a .icon
{
  position: relative;
  display: block;
  min-width: 60px;
  height: 60px;
  line-height: 70px;
  text-align: center;
}
.navigation ul li a .icon ion-icon
{
  position: relative;
  font-size: 1.5em;
  z-index: 1;
}
.navigation ul li a .title 
{
  position: relative;
  display: block;
  padding-left: 10px;
  height: 60px;
  line-height: 60px;
  white-space: nowrap;
}
</style>
</head>

<body>
  <div class="navigation">
    <ul>
      <li class="list active">
        <a href="#">
          <span class="icon"><ion-icon name="home-outline"></ion-icon></span>
          <span class="title">首页</span>
        </a>
      </li>
      <li class="list">
        <a href=&.........完整代码请登录后点击上方下载按钮下载查看

网友评论0