第一格出现在移动视图中

时间:2019-04-23 10:19:02

标签: javascript jquery

在移动视图中,出现第一个div。如何删除它并仅显示活动班级

function myFunction() {
  var x = document.getElementById("myTopnav");
  if (x.className === "topnav") {
    x.className += " responsive";
  } else {
    x.className = "topnav";
  }
}
.topnav {
  overflow: hidden;
  display: -webkit-box !important;
  display: -ms-flexbox !important;
  display: flex !important;
  -webkit-box-pack: start !important;
  -ms-flex-pack: start !important;
  justify-content: flex-start !important;
}

.topnav img {
  border: 5px solid #f15625;
  background-color: #f15625;
  height: 90px;
  width: 90px;
  border-radius: 50% !important;
}

.topnav a {
  float: left;
  color: #f15625;
  text-align: center;
  padding: 30px 40px 0px 40px;
  text-decoration: none;
}

.topnav a:hover {
  color: #fff;
}

.topnav a:hover img,
.topnav .active img {
  color: #fff;
  border: 5px solid #fff;
}

.active,
.topnav .active i {
  color: #f7f7f7 !important;
}

.topnav .icon {
  display: none;
}

.topnav i {
  font-size: 30px;
  display: block;
  margin-bottom: -10px;
  padding-top: 25px;
  color: transparent;
}

@media screen and (max-width: 900px) {
  .topnav a:not(:first-child) {
    display: none;
  }
  .topnav a.icon {
    float: right;
    display: block;
  }
}

@media screen and (max-width: 900px) {
  .topnav.responsive {
    position: relative;
  }
  .topnav.responsive a.icon {
    position: absolute;
    right: 0;
    top: 0;
  }
  .topnav.responsive a {
    float: none;
    display: inline-block;
  }
  .topnav i {
    color: #fff;
  }
  .topnav .fa-caret-up {
    display: none;
  }
  .topnav a {
    padding: 20px 30px;
  }
  .topnav {
    overflow: hidden;
    display: block !important;
  }
  .nav-main {
    padding-left: 80px;
    padding-right: 80px;
  }
}

.nav-main {
  background-color: #212121;
  color: #f15625;
  padding-left: 5%;
  padding-right: 5%;
}

.nav-main h1 {
  margin-top: 10px;
  font-size: 2.5rem;
  margin-bottom: 0;
}

.nav-main span {
  font-size: 0.65rem;
  text-transform: uppercase;
}
<div class="nav-main d-flex justify-content-center">
  <div class="topnav" id="myTopnav">


    <a href="index.html" class="">
      <div class="row no-gutters d-flex justify-content-center">
        <div class="col col-auto"><img src="images/icons/architect-with-helmet.png"></div>
        <div class="col col-auto">
          <div class="col-12">
            <h1 class="counter">18</h1>
          </div>
          <div class="col-12"><span>Active</span></div>
          <div class="col-12"><i class="fa fa-caret-up"></i></div>
        </div>
      </div>

    </a>

    <a href="project_list.html" class="">
      <div class="row no-gutters d-flex justify-content-center">
        <div class="col col-auto"><img src="images/icons/skyline.png"></div>
        <div class="col col-auto">
          <div class="col-12">
            <h1 class="counter">75</h1>
          </div>
          <div class="col-12"><span>Projects</span></div>
          <div class="col-12"><i class="fa fa-caret-up"></i></div>
        </div>
      </div>
    </a>

    <a href="team.html" class="active d-flex justify-content-start">
      <div class="row no-gutters d-flex justify-content-center">
        <div class="col col-auto"><img src="images/icons/work-team.png"></div>
        <div class="col col-auto">
          <div class="col-12">
            <h1 class="counter">99</h1>
          </div>
          <div class="col-12"><span>Teammates</span></div>
          <div class="col-12"><i class="fa fa-caret-up"></i></div>
        </div>
      </div>
    </a>


    <a href="javascript:void(0);" class="icon" onclick="myFunction()"><i class="fa fa-bars"></i></a>


  </div>
</div>

在移动视图中,不会出现活动班级。它在桌面上工作正常。我试图在移动视图中显示class="active",而不是在导航菜单中显示第一格。在移动视图中,第一个div似乎出现在“活动”之前。

0 个答案:

没有答案