0

I've been trying to make my page contents be pushed to the right by 300px (the width of the side nav) when it is opened, as in this github repo here.

I have contained all the content to be pushed in a div #content.

However for some reason this is not impacting here:

function openNav() {
  document.getElementById("Therightnav").style.width = "300px";
  document.getElementById("content").style.marginRight = "300px";
}

function closeNav() {
  document.getElementById("Therightnav").style.width = "0";
  document.getElementById("content").style.marginRight = "50px";
}

Any help would be appreciated.

Rob Hern
  • 131
  • 2
  • 10

1 Answers1

1

Try This Code,

function openNav() {
  document.getElementById("Therightnav").style.width = "300px";
  document.getElementById("footer_container").style.marginRight = "300px";
  var x = document.getElementsByClassName("slideshow-container");
  x[0].style.marginRight = "300px";
}

function closeNav() {
  document.getElementById("Therightnav").style.width = "0";
  document.getElementById("footer_container").style.marginRight = "50px";
var x =   document.getElementsByClassName("slideshow-container");
  x[0].style.marginRight = "50px";
}
Jaydip Shingala
  • 429
  • 2
  • 11
  • 18