Skip to main content
Inspiring
Mar 17, 2019 9:05 PM UTC
Question

Side Nav Bar Question

I found this video on youtube about doing a side navbar, having issues getting it to close, what am I doing wrong?

<!DOCTYPE html>

<html>

<head>

  <title>Responsive Animated Sidebar Menu</title>

  <script defer src="https://use.fontawesome.com/releases/v5.0.7/js/all.js"></script>

  <link rel="stylesheet" href="style.css">

<script>

function openSlideMenu(){

document.getElementById('menu').style.width = '250px';

document.getElementById('content').style.marginLeft = '250px';

}

function closeSlideMenu(){

document.getElementById('menu').style.width = '0';

document.getElementById('content').style.marginLeft = '0';

}

</script>

</head>

<body>

  <div id="content">

 

  <span class="slide">

  <a href="#" onClick="openSlideMenu()">

  <i class="fas fa-bars"></i>

</a>

  </span>

 

  <div id="menu" clSS="nav">

  <a href="#" class="close" onclick="closeSideMenu()">

<i class="fas fa-times"></i>

</a>

<a href="#">Home</a>

<a href="#">About</a>

<a href="#">Services</a>

<a href="#">Contact</a>

  </div>

 

  <h1>S.T. Graffix Menu</h1>

 

</div>

</body>

</html>

This topic is closed to new replies. Start a new post to keep the conversation going.

15 replies

SteveTadAuthor
Inspiring
Mar 17, 2019 11:54 PM UTC

i got it, it just doesnt work in Live mode in DW. lol

Translate
SteveTadAuthor
Inspiring
Mar 17, 2019 9:44 PM UTC

Nancy: I i changed to class, and nothing happened

Osgood: As far as I can tell, they all say Slide

Translate
Legend
Mar 17, 2019 9:52 PM UTC

SteveTad  wrote

Osgood: As far as I can tell, they all say Slide

Nope, not in the code you originally posted the close onclick event says closeSideMenu

Translate
SteveTadAuthor
Inspiring
Mar 17, 2019 9:55 PM UTC

got that fixed, and I still have the same issue

Translate
Legend
Mar 17, 2019 9:22 PM UTC

Your onclick event says closeSideMenu instead of closeSlideMenu - note the missing l in Slide.......

.........or change your function name to match your onclick event name.

Translate
SteveTadAuthor
Inspiring
Mar 17, 2019 9:47 PM UTC

changed it, nothing happened

Translate
Nancy OShea
Community Expert
Community Expert
Mar 17, 2019 9:08 PM UTC

Start with the obvious.

Change this:

  <div id="menu" clSS="nav">

to this:

  <div id="menu" class="nav">

Translate
Nancy O'Shea— Product User & Community Expert
SteveTadAuthor
Inspiring
Mar 17, 2019 9:47 PM UTC

made the change, nothing happened, it stayed the same

Translate
SteveTadAuthor
Inspiring
Mar 17, 2019 9:08 PM UTC