Got a centered fullscreen main at the very middle of the webpage:
<div id="main"></div>
The main opens a default web:
<script>
$("#main").html('<object data="http://www.myweb.com"/>');
</script>
And two hidden sidenavs (one at the left and one at the right) showable through two buttons and with a list of links inside them. sidenavLeft pushes the main to the right when appears, and sidenavRight pushes the main to the left. The default main page can be changed just by clicking on the links inside the sidenav menus.
I can't figure out how to say to the #main, move to the right when the sidebarLeft is shown and to the left when the sidebarRight is shown. I think I need a CSS conditionals to do this, but as far as I know there is no conditional support in CSS.
/* if the sidebarRight is shown, push the page content to the left */
#main {
transition: margin-right .5s;
}
/* if the sidebarLeft is shown, push the page content to the right */
#main {
transition: margin-left .5s;
}
How can I do this with CSS/Jquery/javascript?