JSFiddle - React, Tailwind, and code Playground
HTML
<div id="left_panel">
<div class="open_left">close MENU</div>
</div>
<div id="right_panel">
<div class="open_right">RIGHT MENU</div>
</div>
<div id="container">
<header>
<div id="site-title">TEST SITE</div>
<nav></nav>
</header>
<div id="body">
<div id="ex_buttons">
<ul>
<li>
<div class="open_left"> <span>LEFT MENU</span>
</div>
</li>
<li>
<div class="backtotop"> <span>top</span>
</div>
</li>
<li>
<div class="open_right"> <span>RIGHT MENU</span>
</div>
</li>
</ul>
</div>
<div id="the-content"></div>
</div>
<footer>
<copyright>test site.,co</copyright>
</footer>
</div>
CSS
*, *:before, *:after {
box-sizing: border-box;
}
html, body {
font: normal 16px/100% sans-serif;
margin:0;
padding: 0;
}
#left_panel, #right_panel {
height: 100%;
width: 200px;
background: #eee;
display: none;
color: #666;
font-size: xx-large;
position: fixed;
top: 0;
z-index:9;
}
#left_panel {
float: left;
left: 0;
}
#right_panel {
float: right;
right: 0;
}
#ex_buttons {
position: fixed;
bottom: 0;
width: 100%;
z-index: 99;
}
#ex_buttons ul {
display: flex;
flex-flow: row wrap;
justify-content: space-between;
margin: 0;
padding: 0;
}
#ex_buttons li {
flex: 1 auto;
border: 1px solid #999;
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
height: 3em;
position: relative;
background-color: #ccc;
}
#ex_buttons li span {
display: block;
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
font-size: 0.725rem;
}
/*ここから下、装飾とか色々*/
header {
background-color: #fff;
height: 5em;
border: 1px solid #000;
overflow: hidden;
position: relative;
}
header:before {
content:"";
width: 200px;
height: 200px;
position: absolute;
background-color: #f00;
border-radius: 50%;
left: 50%;
transform: translateX(-50%);
}
#site-title {
font-size: 1.25rem;
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
text-align: center;
}
nav {
position: absolute;
width: 100%;
height: 1em;
bottom: 2px;
background-color: #000;
}
nav a {
color: #fff;
text-decoration: none;
}
nav ul {
display: flex;
flex-flow: row wrap;
justify-content: space-around;
margin: 0;
padding: 0;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
}
nav ul li {
flex: 1 auto;
list-style-type: none;
text-align:center;
}
#left_panel nav {
position: relative;
...
JavaScript
$('.open_left').click(function () {
$("#left_panel").animate({
width: 'toggle'
}, 200);
});
$('.open_right').click(function () {
$("#right_panel").animate({
width: 'toggle'
}, 200);
});
$("nav").clone().appendTo("#left_panel");
// -----------------------------------------------
// ここから下は記事を構成するために利用する分で必要ありません
// -----------------------------------------------
//make menu(like grobal menu)
$("nav").append("<ul></ul");
var dat = [
{"href": 1, "name": "a"},
{"href": 2, "name": "b"},
{"href": 3, "name": "c"},
{"href": 4, "name": "d"}
];
for (var i in dat) {
$("nav ul").append("<li><a href='#" + dat[i].href + "'>menu_" + dat[i].name + "</a>");
}
//make post
$("#the-content").append("<div id='main'><p>便宜上メニューは表示してます</p><br/></div>");
$("#the-content").append("<div id='sidebar'></div>");
function isPrime(n) {
if (isNaN(n) || !isFinite(n) || n % 1 || n < 2) return false;
var m = Math.sqrt(n);
for (var i = 2; i <= m; i++) if (n % i == 0) return false;
return true;
}
function words(str, loop) {
var out_str = "";
for(var i=0; i < loop; i++){
if (isPrime(i)){
out_str += str + "<br />";
} else {
out_str += str + " ";
}
}
return out_str;
}
$("#main").append(words("あああああ", 100));
$("#sidebar").append(words("いいいいい", 50));