Jump to content

I Broke the Functionality of the Following:


Lindsay K.

Recommended Posts

https://www.w3schools.com/howto/howto_js_responsive_navbar_dropdown.asp

Sizing down the dropdown provides only one sub and the icon hover ceased to respond.

Any suggestions? Thanks!

<html>
   <head><meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
      <title>Ace Pawn Shop</title>
      <link rel="stylesheet" href="style2.css">
<link href="favicon_o.png" rel="icon" />
   </head>

   <body bgcolor="#FFFFFF">
      <b>
         <img align="center" src="logo2.jpg" height="200px" width="97%" />
              <div class="topnav" id="myTopnav">
  <a href="home.htm" class="active" target="tgt">Home</a>
  <a href="soon.htm" target="tgt">News</a>
  <a href="soon.htm" target="tgt">Contact</a>
  <div class="dropdown">
    <button class="dropbtn">Locations
      <i class="fa fa-caret-down"></i>
    </button>
    <div class="dropdown-content">
      <a href="soon.htm" target="tgt">Ace Pawn: Downtown</a>
      <a href="soon.htm" target="tgt">Ace Pawn: West</a>
      <a href="home.htm" target="tgt">Ace Pawn: Bedford</a>
    </div>
  </div>
  <a href="soon.htm" target="tgt">About</a>
  <a href="javascript:void(0);" class="icon" onclick="myFunction()">&#9776;</a>
</div>  

<div align="center"><iframe src="home.htm" width="80%" height="400" frameborder="0" name="tgt" padding="0"></iframe>
            </div>
<div class="footer" width="100%"><p class="alignleft"><a href="https://www.facebook.com/Ace-Pawn-Shop-103279389721696" target="_new"><img class="vert" src="facebook-16.png"></a></p><p class="alignright">(c)2018 Ace Pawn | All Rights Reserved | <script language="Javascript">
document.write("Last Modified " + document.lastModified +"");
</SCRIPT><div style="clear: both;"></div></div>

   </body>
</html>

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

.menu {
    display: flex;
    justify-content: space-between;
}

a {
    text-decoration: none;
    color: #000000;
}

a:visited {
    color: #666666;
}

a:hover {
    color: #CCCCCC;
}

a:active {
    color: #333333;
}

iframe {
    width: 100%;
    height: 60%;
    margin: 0px;
    padding: 0px;
    border: 0px;
    display: block;
}

 /* Add a background color to the top navigation */
.topnav {
    background-color: #666;
    overflow: auto;
}

/* Style the links inside the navigation bar */
.topnav a {
    float: left;
    display: block;
    color: #ffffff;
    text-align: center;
    padding: 0px 16px;
    text-decoration: none;
    font-size: 45px;
    text-transform: uppercase;
    font-family: helvetica;
}

/* Add an active class to highlight the current page */
/* .active {
    background-color: #4CAF50;
    color: white;
} */

/* Hide the link that should open and close the topnav on small screens */
.topnav .icon {
    display: none;
}

/* Dropdown container - needed to position the dropdown content */
.dropdown {
    float: left;
    overflow: auto;
}

/* Style the dropdown button to fit inside the topnav */
.dropdown .dropbtn {
    font-size: 45px;
    border: none;
    outline: none;
    color: white;
/*    padding: 0px 16px; */
    background-color: inherit;
    font-family: Helvetica;
/*    margin: 0; */
    text-transform: uppercase;
    font-weight: bold;
}

/* Style the dropdown content (hidden by default) */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 160px;
/*    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); */
    z-index: 1;
}

/* Style the links inside the dropdown */
.dropdown-content a {
    font-size: 36px;
    float: none;
    color: black;
 /*   padding: 0px 16px; */
    text-decoration: none;
    display: block;
    text-align: left;
    text-transform: uppercase;
    font-family: Helvetica;
}

/* Add a dark background on topnav links and the dropdown button on hover */
.topnav a:hover, .dropdown:hover .dropbtn {
    background-color: #555;
    color: white;
}

/* Add a grey background to dropdown links on hover */
.dropdown-content a:hover {
    background-color: #fff;
    color: orange;
}

/* Show the dropdown menu when the user moves the mouse over the dropdown button */
.dropdown:hover .dropdown-content {
    display: block;
}

/* When the screen is less than 600 pixels wide, hide all links, except for the first one ("Home"). Show the link that contains should open and close the topnav (.icon) */
@media screen and (max-width: 600px) {
  .topnav a:not(:first-child) {display: none;}
  .topnav a.icon {
    float: right;
    display: block;
  }
}

/* The "responsive" class is added to the topnav with JavaScript when the user clicks on the icon. This class makes the topnav look good on small screens (display the links vertically instead of horizontally) */
@media screen and (max-width: 600px) {
  .topnav.responsive {position: relative;}
  .topnav.responsive a.icon {
    position: absolute;
    right: 0;
    top: 0;
  }
  .topnav.responsive a {
    float: none;
    display: block;
    text-align: left;
  }
  .topnav.responsive .dropdown {float: none;}
  .topnav.responsive .dropdown-content {position: relative;}
  .topnav.responsive .dropdown .dropbtn {
    display: block;
    width: 100%;
    text-align: left;
  }
}  

.footer {
background-color: #666;
width: 100%;
color: #fff;
float: left;
font-size: 16px;
font-family: Helvetica;
font-weight: normal;
padding: 0px 0px;
}

.vert {
    vertical-align:middle;
}

.alignleft {
	float: left;
	margin: 0;
    padding: 0;
}
.alignright {
	float: right;
	margin: 0;
    padding: 0;
}

p {
    
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...