使侧导航在打开时向右推送内容(JQuery)

使侧导航在打开时向右推送内容(JQuery),jquery,nav,Jquery,Nav,我一直在努力使我的页面内容在打开时向右移动300像素(侧导航的宽度),如中所示 我已将所有要推送的内容包含在div内容中 然而,出于某种原因,这并不影响以下方面: function openNav() { document.getElementById("Therightnav").style.width = "300px"; document.getElementById("content").style.marginRight = "300px"; } function close

我一直在努力使我的页面内容在打开时向右移动300像素(侧导航的宽度),如中所示

我已将所有要推送的内容包含在div内容中

然而,出于某种原因,这并不影响以下方面:

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";
}
任何帮助都将不胜感激。

请尝试此代码

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";
}