Liam
Liam

Reputation: 79

Why does my navbar page links not display on a mobile view when the hamburger icon is selected?

On mobile view when I click on the three line icon in order to get the navbar links to display nothing appears. How can I get my navbar links to appear?

Navbar when I click on the navbar icon on mobile

Trying to get my navbar page links to display like this https://i.sstatic.net/Dgck2.jpg. When I click on the navbar hamburger icon I think its called all the links display. On my site nothing displays.

/**
 * Header
 */

.header {
  position: relative;
  z-index: 5;
}

.header-toparea {
  background: #333333;
  color: #ffffff;
  padding: 10px 0;
}

.header-topinfo ul {
  padding-left: 0;
  margin-bottom: 0;
}

.header-topinfo ul li {
  list-style: none;
  display: inline-block;
  font-size: 14px;
  margin: 0 17px;
  padding: 2px 0;
}

.header-topinfo ul li:first-child {
  margin-left: 0;
}

.header-topinfo ul li:last-child {
  margin-right: 0;
}

.header-topinfo ul li i {
  margin-right: 10px;
  font-size: 18px;
}

.header-topinfo ul li a {
  color: #ffffff;
}

.header-topinfo ul li a:hover {
  color: #3423A6;
}

.header-topsocial {
  text-align: right;
}

.header-topsocial ul {
  padding-left: 0;
  margin-bottom: 0;
}

.header-topsocial ul li {
  list-style: none;
  display: inline-block;
  margin: 0 6px;
  padding: 2px 0;
}

.header-topsocial ul li:first-child {
  margin-left: 0;
}

.header-topsocial ul li:last-child {
  margin-right: 0;
}

.header-topsocial ul li a {
  color: #ffffff;
  font-size: 15px;
}

.header-topsocial ul li a:hover {
  color: #3423A6;
}

.header-bottomarea {
  background: #ffffff;
  -webkit-box-shadow: 5px 0 5px rgba(0, 0, 0, 0.15);
  box-shadow: 5px 0 5px rgba(0, 0, 0, 0.15);
  z-index: 3;
  position: relative;
}

.header-bottominner {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  position: relative;
}

.header-bottominner .tm-navigation {
  text-align: right;
  -webkit-box-flex: 1;
  -ms-flex-positive: 1;
  flex-grow: 1;
}

.header-logo a {
  display: inline-block;
}

.header-icons {
  padding-left: 15px;
}

.header-icons ul {
  padding-left: 0;
  margin-bottom: 0;
}

.header-icons ul li {
  list-style: none;
  display: inline-block;
  margin: 0 7px;
}

.header-icons ul li:first-child {
  margin-left: 0;
}

.header-icons ul li:last-child {
  margin-right: 0;
}

.header-icons ul li a {
  color: #444444;
  font-size: 21px;
}

.header-icons ul li a:hover {
  color: #3423A6;
}

.header-searchbox {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  background: #ffffff;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  z-index: -1;
  overflow: hidden;
  -webkit-transition: all 0.4s ease-in-out 0s;
  -o-transition: all 0.4s ease-in-out 0s;
  transition: all 0.4s ease-in-out 0s;
}

.header-searchbox .search-close {
  padding: 0;
  color: #333333;
  font-size: 20px;
  border: none;
  cursor: pointer;
}

.header-searchbox .search-close i {
  line-height: 50px;
  vertical-align: middle;
}

.header-searchbox .search-close:hover {
  color: #3423A6;
}

.header-searchbox.is-visible {
  z-index: 1;
}

.header-searchinner {
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  margin-top: -25px;
  opacity: 0;
  visibility: hidden;
  -webkit-transform: translateY(-100%);
  -ms-transform: translateY(-100%);
  transform: translateY(-100%);
  -webkit-transition: all 0.4s ease-in-out 0s;
  -o-transition: all 0.4s ease-in-out 0s;
  transition: all 0.4s ease-in-out 0s;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
}

.header-searchform {
  -webkit-box-flex: 1;
  -ms-flex-positive: 1;
  flex-grow: 1;
}

.header-searchform input {
  height: 45px;
  border: none;
  padding: 0;
  font-size: 16px;
}

.header-searchbox.is-visible .header-searchinner {
  opacity: 1;
  visibility: visible;
  -webkit-transform: translateY(0);
  -ms-transform: translateY(0);
  transform: translateY(0);
}

@media only screen and (min-width: 768px) and (max-width: 991px) {
  .header-logo {
    padding: 15px 0;
  }
  .header-icons {
    padding-right: 45px;
  }
  .header-searchbox.is-visible {
    z-index: 3;
  }
}

@media only screen and (max-width: 580px) {
  .header-topinfo ul li {
    display: block;
    text-align: center;
  }
  .header-topsocial ul {
    text-align: center;
  }
}

@media only screen and (max-width: 767px) {
  .header-topinfo ul li {
    margin: 0;
    margin-right: 12px;
  }
  .header-logo {
    padding: 15px 0;
  }
  .header-icons {
    padding-right: 45px;
  }
  .header-searchbox.is-visible {
    z-index: 3;
  }
}

@media only screen and (max-width: 480px) {
  .header-logo {
    max-width: 130px;
    padding: 22px 0;
  }
}

.header-mobilemenu .mean-container .mean-nav {
  margin-top: 0;
}

.header-mobilemenu .mean-container .mean-bar {
  min-height: 0;
  padding: 0;
  z-index: 2;
}

.header-mobilemenu .mean-container a.meanmenu-reveal {
  color: #444444;
  font-size: 22px !important;
  padding: 0;
  text-indent: 0;
  z-index: 99;
  margin-top: -9px;
}

.header-mobilemenu .mean-container .mean-nav {
  background: #3423A6;
  background: #3423A6;
  position: absolute;
  left: 0;
  top: 100%;
  right: 0;
  width: 100%;
}

.header-mobilemenu .mean-container .mean-nav>ul {
  max-height: 196px;
  overflow-y: auto;
}

.header-mobilemenu .mean-container .mean-nav>ul li a {
  padding: 7px 5%;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.header-mobilemenu .mean-container .mean-nav>ul li a.mean-expand {
  padding: 3px 6px !important;
  height: 32px;
  line-height: 32px;
}

.header-mobilemenu .mean-container .mean-nav>ul li a.mean-expand:hover {
  background: rgba(255, 255, 255, 0.1);
}

.header-mobilemenu .mean-container .mean-nav>ul li li a {
  opacity: 1;
}

.header-mobilemenu .mean-container .mean-nav>ul li ul li a {
  padding: 7px 10%;
}

.header-mobilemenu .mean-container .mean-nav>ul li ul ul li a {
  padding: 7px 15%;
}

.header-mobilemenu .mean-container .mean-nav>ul li ul ul ul li a {
  padding: 7px 20%;
}

.header.sticky-active .header-bottomarea {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 99;
  -webkit-animation: slideInDown 0.5s ease-in-out 0s 1 both;
  animation: slideInDown 0.5s ease-in-out 0s 1 both;
}


/**
 * Navigation
 */

.tm-navigation ul {
  margin-bottom: 0;
  padding-left: 0;
  font-size: 0;
}

.tm-navigation ul li {
  display: inline-block;
  list-style: none;
  font-size: 16px;
  position: relative;
}

.tm-navigation ul li a {
  display: inline-block;
  font-size: 16px;
  font-family: "Roboto", sans-serif;
  font-weight: 500;
  padding: 28px 20px;
  color: #444444;
}

.tm-navigation ul li:hover>a,
.tm-navigation ul li.current>a {
  color: #3423A6;
}


/* Dropdown Menu */

.tm-navigation .tm-navigation-dropdown ul {
  position: absolute;
  text-align: left;
  left: 100%;
  top: 0;
  width: 230px;
  background: rgba(255, 255, 255, 0.98);
  -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-bottom: 4px solid #aaaaaa;
  visibility: hidden;
  opacity: 0;
  -webkit-transform: scaleY(0);
  -ms-transform: scaleY(0);
  transform: scaleY(0);
  -webkit-transform-origin: 0 0;
  -ms-transform-origin: 0 0;
  transform-origin: 0 0;
  z-index: -1;
  -webkit-transition: visibility 0.2s ease-in-out 0s, opacity 0.2s ease-in-out 0s, z-index 0s, -webkit-transform 0.2s ease-in-out 0s;
  transition: visibility 0.2s ease-in-out 0s, opacity 0.2s ease-in-out 0s, z-index 0s, -webkit-transform 0.2s ease-in-out 0s;
  -o-transition: transform 0.2s ease-in-out 0s, visibility 0.2s ease-in-out 0s, opacity 0.2s ease-in-out 0s, z-index 0s;
  transition: transform 0.2s ease-in-out 0s, visibility 0.2s ease-in-out 0s, opacity 0.2s ease-in-out 0s, z-index 0s;
  transition: transform 0.2s ease-in-out 0s, visibility 0.2s ease-in-out 0s, opacity 0.2s ease-in-out 0s, z-index 0s, -webkit-transform 0.2s ease-in-out 0s;
}

.tm-navigation .tm-navigation-dropdown ul li {
  display: block;
  padding: 0 15px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  -webkit-transition: all 0.3s ease-in-out 0s;
  -o-transition: all 0.3s ease-in-out 0s;
  transition: all 0.3s ease-in-out 0s;
}

.tm-navigation .tm-navigation-dropdown ul li a {
  padding: 10px 0;
  line-height: 1.3;
  display: block;
  font-weight: 400;
  font-size: 14px;
}

.tm-navigation .tm-navigation-dropdown ul li:hover {
  background: #3423A6;
}

.tm-navigation .tm-navigation-dropdown ul li:hover>a {
  color: #ffffff;
}

.tm-navigation .tm-navigation-dropdown ul li:hover>ul {
  visibility: visible;
  opacity: 1;
  -webkit-transform: scaleY(1);
  -ms-transform: scaleY(1);
  transform: scaleY(1);
  z-index: 1;
}

.tm-navigation .tm-navigation-dropdown>ul {
  left: 0;
  top: 100%;
}

.tm-navigation .tm-navigation-dropdown:hover>ul {
  visibility: visible;
  opacity: 1;
  -webkit-transform: scaleY(1);
  -ms-transform: scaleY(1);
  transform: scaleY(1);
  z-index: 9;
}

.tm-navigation .tm-navigation-dropdown.overflow-element ul {
  left: auto;
  right: 100%;
}

.tm-navigation .tm-navigation-dropdown.overflow-element>ul {
  left: auto;
  right: 0;
}

.tm-navigation .tm-navigation-megamenu {
  position: inherit !important;
}

.tm-navigation .tm-navigation-megamenu>ul {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  position: absolute;
  text-align: left;
  left: 0;
  top: 100%;
  width: 100%;
  background: rgba(255, 255, 255, 0.98);
  -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-bottom: 4px solid #aaaaaa;
  padding: 15px;
  visibility: hidden;
  opacity: 0;
  -webkit-transform: scaleY(0);
  -ms-transform: scaleY(0);
  transform: scaleY(0);
  -webkit-transform-origin: 0 0;
  -ms-transform-origin: 0 0;
  transform-origin: 0 0;
  z-index: -1;
  -webkit-transition: visibility 0.2s ease-in-out 0s, opacity 0.2s ease-in-out 0s, z-index 0s, -webkit-transform 0.2s ease-in-out 0s;
  transition: visibility 0.2s ease-in-out 0s, opacity 0.2s ease-in-out 0s, z-index 0s, -webkit-transform 0.2s ease-in-out 0s;
  -o-transition: transform 0.2s ease-in-out 0s, visibility 0.2s ease-in-out 0s, opacity 0.2s ease-in-out 0s, z-index 0s;
  transition: transform 0.2s ease-in-out 0s, visibility 0.2s ease-in-out 0s, opacity 0.2s ease-in-out 0s, z-index 0s;
  transition: transform 0.2s ease-in-out 0s, visibility 0.2s ease-in-out 0s, opacity 0.2s ease-in-out 0s, z-index 0s, -webkit-transform 0.2s ease-in-out 0s;
}

.tm-navigation .tm-navigation-megamenu>ul>li {
  display: block;
  width: 100%;
  margin: 15px 0;
  padding: 0 20px;
}

.tm-navigation .tm-navigation-megamenu>ul>li:not(:last-child) {
  border-right: 1px solid #dddddd;
}

.tm-navigation .tm-navigation-megamenu>ul>li>a {
  display: block;
  color: #3423A6;
  border-bottom: 1px solid #3423A6;
  padding: 0;
  padding-bottom: 5px;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 14px;
}

.tm-navigation .tm-navigation-megamenu>ul ul li {
  display: block;
}

.tm-navigation .tm-navigation-megamenu>ul ul li a {
  padding: 5px 0;
  line-height: 1.3;
  display: block;
  font-weight: 400;
  font-size: 14px;
}

.tm-navigation .tm-navigation-megamenu>ul ul li a:hover {
  padding-left: 10px;
}

.tm-navigation .tm-navigation-megamenu:hover>ul {
  visibility: visible;
  opacity: 1;
  -webkit-transform: scaleY(1);
  -ms-transform: scaleY(1);
  transform: scaleY(1);
  z-index: 9;
}
<!-- Header Bottom Area -->
<div class="header-bottomarea">
  <div class="container">
    <div class="header-bottominner">
      <div class="header-logo">
        <a href="index.html">
          <img src="assets/images/logo/same-day-delivery2.png" alt="logo">
        </a>
      </div>
      <nav class="tm-navigation">
        <ul>
          <li><a href="index-2.html">Home</a></li>
          <li><a href="about-us.html">About</a></li>
          <li><a href="services.html">Services</a></li>
          <li><a href="contact-us.html">Contact</a></li>
        </ul>
      </nav>
      <div class="header-mobilemenu clearfix">
        <div class="tm-mobilenav"></div>
      </div>
    </div>
  </div>
</div>
<!--// Header Bottom Area -->

Upvotes: 0

Views: 81

Answers (1)

<!--  JS for default hide/navigate-->
function myFunction() {
  var x = document.getElementById("myLinks");
  if (x.style.display === "block") {
    x.style.display = "none";
  } else {
    x.style.display = "block";
  }
}
body {
  font-family: Arial, Helvetica, sans-serif;
}

.mobile-container {
  max-width: 480px;
  margin: auto;
  background-color: #555;
  height: 500px;
  color: white;
  border-radius: 10px;
}

.topnav {
  overflow: hidden;
  background-color: #333;
  position: relative;
}

.topnav #myLinks {
  display: none;
}

.topnav a {
  color: white;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 17px;
  display: block;
}

.topnav a.icon {
  background: black;
  display: block;
  position: absolute;
  right: 0;
  top: 0;
}

.topnav a:hover {
  background-color: #ddd;
  color: black;
}

.active {
  background-color: #4CAF50;
  color: white;
}
<link rel="stylesheet" href="C:\Users\HP\Desktop\html\New folder\css\fontawesome.min.css">

<!-- Simulate a smartphone / tablet -->
<div class="mobile-container">

<!-- Top Navigation Menu -->
<div class="topnav">
  <a href="#home" class="active">Logo</a>
  <div id="myLinks">
    <a href="#news">News</a>
    <a href="#contact">Contact</a>
    <a href="#about">About</a>
  </div>
  <a href="javascript:void(0);" class="icon" onclick="myFunction()">
    <i class="fa fa-bars"></i>
  </a>
</div>

<div style="padding-left:16px">
  <h3>hamburger</h3>
  <p>example navigation menu on a mobile phone view</p>
</div>

</div>

I just used JavaScript and you can use** font-awesome.min.css CDN

Upvotes: 1

Related Questions