2017-07-06 70 views
0

我一直試圖使我的頁面內容在打開時被向右推300px(側導航的寬度),如this github repo here打開時將側導航內容向右推(JQuery)

我已經包含了所有要推入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"; 
} 

任何幫助,將不勝感激。

回答

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"; 
} 
相關問題