To give a basic idea of what I hope to accomplish;
I currently have a site live at: http://shiinachi.com
As it is, the body element is changed using javascript when clicking between the home and email tab.
However, I hope to redo this. I aim to have the width of the body expand when a button is clicked, so the body "drops down" to show the menu in question.
I have experimented using an onload function to trigger a css class;
function bodyloaderS() { classList.add("body-loader")
The css of the body is set to a width of 0 by default, then I attempted to use the body-loader class in question to adjust the width.
body-section.body-loader{ width: 745px; }
I then called the transition onload to test it. However... The results were less than successful. Is there a better way I can go about doing this?
Edit: Here's a dump of the code being used
Body tag;
<div id="body-section" onload="bodyloaderS(document.body-section)">
<h1>Home</h1>
<p>Hello.<br><br>Temp</p> </div>
Relevant CSS;
#body-section{
position: relative;
padding-left: 50px;
padding-top: 50px;
padding-right: 50px;
height: 350px;
width: 0px;
transition: width 2s;
border-color: #ffffff;
border-style: solid;
border-width: 1px 1px 3px 3px;
border-radius: 3px 9px 3px 0px;
top: -752px;
left: 325px;
background-color: #222222;
}
#body-section.body-loader{
width: 745px;
}
The script in use;
<script>
function bodyloaderS() { classList.add("body-loader")
}
</script>