下拉菜单在移动设备上不起作用

时间:2019-02-13 21:44:42

标签: css twitter-bootstrap drop-down-menu

我看过很多关于类似问题的文章,花了数小时寻找,但是这些修复似乎都不对我有用。

我正在直接从CDN使用最新版本的引导程序。

我有一个导航菜单,其中有可悬停的桌面下拉菜单。这些工作正常,但是您可以想象在移动设备上无法运行。我已经尝试了很多建议的修复程序,但仍然面临着相同的问题。

这是网站整个标题部分的代码:

.nav-menu,
.nav-menu * {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-menu ul {
  position: absolute;
  display: none;
  top: 100%;
  left: 0;
  z-index: 99;
}

.nav-menu li {
  position: relative;
  white-space: nowrap;
}

.nav-menu>li {
  float: left;
}

#nav-menu-container {
  float: right;
  margin: 0;
}

/* Nav Meu Styling */
.nav-menu a {
  padding: 8px;
  text-decoration: none;
  display: inline-block;
  color: rgba(202, 206, 221, 0.8);
  font-family: "Raleway", sans-serif;
  font-weight: 600;
  font-size: 14px;
  outline: none;
}

.nav-menu .menu-active a,
.nav-menu a:hover {
  color: #fff;
}

.nav-menu>li {
  margin-left: 8px;
}

.nav-menu>li>a:before {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: #f82249;
  visibility: hidden;
  transition: all 0.3s ease-in-out 0s;
}

.nav-menu>li ul li>a:before {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: #f82249;
  visibility: hidden;
  transition: all 0.3s ease-in-out 0s;
}

.nav-menu a:hover:before,
.nav-menu body.hasHoverli:hover>a:before,
.nav-menu .menu-active>a:before {
  visibility: visible;
  width: 100%;
}

.nav-menu li.buy-tickets a {
  color: #fff;
  background: #f82249;
  padding: 7px 22px;
  border-radius: 50px;
  border: 2px solid #f82249;
  transition: all ease-in-out 0.3s;
  font-weight: 500;
  margin-left: 8px;
  margin-top: 2px;
  line-height: 1;
  font-size: 13px;
}

.nav-menu li.buy-tickets a:hover {
  background: none;
}

.nav-menu li.buy-tickets:hover a:before,
.nav-menu li.buy-tickets.menu-active a:before {
  visibility: hidden;
}

.nav-menu ul {
  margin: 0 0 0 -12px;
  padding: 10px;
  background: rgba(51, 51, 51, 1);
  border-radius: 3px;
}

/* Mobile Nav Toggle */
#mobile-nav-toggle {
  position: fixed;
  right: 0;
  top: 0;
  z-index: 999;
  margin: 15px 15px 0 0;
  border: 0;
  background: none;
  font-size: 24px;
  display: none;
  transition: all 0.4s;
  outline: none;
  cursor: pointer;
}

#mobile-nav-toggle i {
  color: #fff;
}

/* Mobile Nav Styling */
#mobile-nav {
  position: fixed;
  margin-top: 70px;
  z-index: 998;
  background: rgba(51, 51, 51, 1);
  top: -100%;
  width: 100%;
  overflow-y: auto;
  transition: 0.4s;
  border-bottom: 1px solid rgba(248, 34, 73, 1);
}

#mobile-nav ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

#mobile-nav ul li a {
  color: #fff;
  font-size: 17px;
  overflow: hidden;
  padding: 10px 22px 10px 15px;
  position: relative;
  text-decoration: none;
  width: 100%;
  display: block;
  outline: none;
}

#mobile-nav ul li a:hover {
  color: #f82249;
}

#mobile-nav ul .menu-item-active {
  color: #f82249;
}

#mobile-body-overly {
  width: 100%;
  height: 100%;
  z-index: 997;
  top: 70px;
  left: 0;
  position: fixed;
  background: rgba(51, 51, 51, 0.8);
  display: none;
}

/* Mobile Nav body classes */
body.mobile-nav-active {
  overflow: hidden;
}

body.mobile-nav-active #mobile-nav {
  top: 0;
}

body.mobile-nav-active #mobile-nav-toggle {
  color: #fff;
}
<header id="header">
  <div class="container">
    <div id="logo" class="pull-left">
      <a href="index.php" class="scrollto"><img src="img/logo.png" alt="" title=""></a>
    </div>
    <nav id="nav-menu-container">
      <ul class="nav-menu">
        <li><a href="index.php?page=exhibitorlist&id=0&pagen=1">Exhibitor List</a></li>
        
        <!-- Visitor Information Drop Down -->
        <li><a href="#">Visitor Information</a>
          <ul class="dropdown">
            <li><a href="index.php?page=abouttheshow">About The Show</a></li>
            <li><a href="index.php?page=attractions">Attractions & Features</a></li>
            <li><a href="index.php?page=gettinghere">Getting Here</a></li>
            <li><a href="index.php?page=faq">FAQ's</a></li>
          </ul>
        </li>
        <!-- End Visitor Information Drop Down -->
        
        <!-- Exhibitor Information Drop Down -->
        <li><a href="#about">Exhibitor Information</a>
          <ul class="dropdown">
            <li><a href="index.php?page=exhibitwithus">Exhibit With Us</a></li>
            <li><a href="https://floorplan.live/data/api/events/973/views/19/pdf-external">Floor Plan</a></li>
            <li><a href="index.php?page=sponsorship">Sponsorship</a></li>
            <li><a href="index.php?page=exhibitorfaq">FAQ's</a></li>
          </ul>
        </li>
        <!-- End Exhibitor Information Drop Down -->

        <li><a href="index.php?page=accommodation">Accommodation</a></li>
        <li><a href="index.php?page=contact">Contact</a></li>
        <li><a href="http://www.vaperexpo.co.uk/dashboardmay19/?ng=client/login/">Exhibitor Login</a></li>
        <li class="buy-tickets"><a href="index.php?page=buytickets">Buy Tickets</a></li>
      </ul>
    </nav>
  </div>
</header>

整个网站基于另一个主题,巧合的是,该主题在移动设备上也无法正常工作。

您可以在此处查看实时站点:www.vaperexpo.co.uk/newsite

任何帮助都将不胜感激。

0 个答案:

没有答案