Skip to content

Instantly share code, notes, and snippets.

@reyaz
Created July 30, 2020 00:10
Show Gist options
  • Save reyaz/0d09d4549845a6b52ee4a6ffe7ebcb21 to your computer and use it in GitHub Desktop.
Save reyaz/0d09d4549845a6b52ee4a6ffe7ebcb21 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/merimuk
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
* {
box-sizing: border-box;
}
body {
background: #eeeeee;
display: grid;
height: 100%;
margin: 0;
padding-left: 3rem;
position: relative;
}
div {
background: #ffffff;
border-radius: 4px;
box-shadow: 0 4px 4px rgba(0,0,0,0.25);
position: relative;
z-index: 0;
}
div:hover {
background: lime;
z-index: 999999;
}
header {
display: grid;
height: 100%;
position: absolute;
top: 0;
width: 3rem;
z-index: 1;
}
header::before {
background: #cccccc;
box-shadow: 0 4px 4px rgba(0,0,0,0.25);
content: '';
display: block;
position: relative;
z-index: 2;
}
header:hover {
width: 6rem;
}
header div {
border-radius: none;
height: 100%;
left: 100%;
max-width: calc(100vw - 100% - 1rem);
position: absolute;
top: 0;
width: 24rem;
z-index: 1;
}
html {
height: 100%;
}
main {
display: grid;
grid-gap: 1em;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
margin: 0;
padding: 1rem;
position: relative;
}
main div {
position: relative;
}
</style>
</head>
<body>
<header></header>
<main></main>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.9.2/d3.min.js"></script>
<script id="jsbin-javascript">
d3.select('header')
.selectAll('div.chrome')
.data([{}])
.join('div')
.classed('chrome', true)
d3.select('main')
.selectAll('div.chrome')
.data([...Array(5).keys()].map(() => ({})))
.join('div')
.classed('chrome', true)
</script>
<script id="jsbin-source-css" type="text/css">* {
box-sizing: border-box;
}
body {
background: #eeeeee;
display: grid;
height: 100%;
margin: 0;
padding-left: 3rem;
position: relative;
}
div {
background: #ffffff;
border-radius: 4px;
box-shadow: 0 4px 4px rgba(0,0,0,0.25);
position: relative;
z-index: 0;
}
div:hover {
background: lime;
z-index: 999999;
}
header {
display: grid;
height: 100%;
position: absolute;
top: 0;
width: 3rem;
z-index: 1;
}
header::before {
background: #cccccc;
box-shadow: 0 4px 4px rgba(0,0,0,0.25);
content: '';
display: block;
position: relative;
z-index: 2;
}
header:hover {
width: 6rem;
}
header div {
border-radius: none;
height: 100%;
left: 100%;
max-width: calc(100vw - 100% - 1rem);
position: absolute;
top: 0;
width: 24rem;
z-index: 1;
}
html {
height: 100%;
}
main {
display: grid;
grid-gap: 1em;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
margin: 0;
padding: 1rem;
position: relative;
}
main div {
position: relative;
}
</script>
<script id="jsbin-source-javascript" type="text/javascript">d3.select('header')
.selectAll('div.chrome')
.data([{}])
.join('div')
.classed('chrome', true)
d3.select('main')
.selectAll('div.chrome')
.data([...Array(5).keys()].map(() => ({})))
.join('div')
.classed('chrome', true)
</script></body>
</html>
* {
box-sizing: border-box;
}
body {
background: #eeeeee;
display: grid;
height: 100%;
margin: 0;
padding-left: 3rem;
position: relative;
}
div {
background: #ffffff;
border-radius: 4px;
box-shadow: 0 4px 4px rgba(0,0,0,0.25);
position: relative;
z-index: 0;
}
div:hover {
background: lime;
z-index: 999999;
}
header {
display: grid;
height: 100%;
position: absolute;
top: 0;
width: 3rem;
z-index: 1;
}
header::before {
background: #cccccc;
box-shadow: 0 4px 4px rgba(0,0,0,0.25);
content: '';
display: block;
position: relative;
z-index: 2;
}
header:hover {
width: 6rem;
}
header div {
border-radius: none;
height: 100%;
left: 100%;
max-width: calc(100vw - 100% - 1rem);
position: absolute;
top: 0;
width: 24rem;
z-index: 1;
}
html {
height: 100%;
}
main {
display: grid;
grid-gap: 1em;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
margin: 0;
padding: 1rem;
position: relative;
}
main div {
position: relative;
}
d3.select('header')
.selectAll('div.chrome')
.data([{}])
.join('div')
.classed('chrome', true)
d3.select('main')
.selectAll('div.chrome')
.data([...Array(5).keys()].map(() => ({})))
.join('div')
.classed('chrome', true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment