【问题标题】:Making the side nav push content to the right when open (JQuery)使侧导航在打开时将内容推送到右侧(JQuery)
【发布时间】:2017-07-06 22:31:33
【问题描述】:

我一直在尝试让我的页面内容在打开时向右推 300 像素(侧导航的宽度),如 this github repo here

我已将所有要推送的内容包含在一个 div #content 中。

但是由于某种原因,这在这里没有影响:

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

任何帮助将不胜感激。

【问题讨论】:

    标签: jquery nav


    【解决方案1】:

    试试这个代码,

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-07-12
      • 2016-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-27
      • 1970-01-01
      相关资源
      最近更新 更多