使侧边导航在打开时向右推送内容 (JQuery)
Making the side nav push content to the right when open (JQuery)
我一直在尝试让我的页面内容在打开时向右移动 300px(侧导航的宽度),如 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";
}
如有任何帮助,我们将不胜感激。
试试这个代码,
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";
}
我一直在尝试让我的页面内容在打开时向右移动 300px(侧导航的宽度),如 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";
}
如有任何帮助,我们将不胜感激。
试试这个代码,
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";
}