Built with blockbuilder.org
xxxxxxxxxx
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<script>
// Feel free to change or delete any of the code you see in this editor!
var svg = d3.select("body").append("svg")
.attr("width", 960)
.attr("height", '100%')
let toolbar = svg.append('g');
let links = ['Home', 'Menu Item 1', 'Menu Item 2', 'Menu Item 3'];
function expandToolbar() {
let elem = d3.select(this);
elem
.transition()
.duration(1000)
.ease(d3.easeCircleOut)
.attr('width', '20%')
.attr('height', '100%')
.attr('z-index', 1);
let textEnter = elem.selectAll('text')
.data(links)
textEnter
.enter()
.append('text')
.text(t => t)
.attr('fill', 'white')
.attr('z-index', 1000)
}
function collapseToolbar() {
let elem = d3.select(this);
elem
.transition()
.duration(700)
.ease(d3.easeCircleIn)
.attr('width', '2%')
.attr('height', '100%');
}
toolbar
.append('rect')
.attr('width', '2%')
.attr('height', '100%')
.on('mouseover', expandToolbar)
.on('mouseout', collapseToolbar)
</script>
</body>
https://d3js.org/d3.v4.min.js