Skip to content

Instantly share code, notes, and snippets.

@amattu2
Created February 4, 2021 21:28
Show Gist options
  • Save amattu2/bdef8a9a7a1fd5c432e0cb4efd19479d to your computer and use it in GitHub Desktop.
Save amattu2/bdef8a9a7a1fd5c432e0cb4efd19479d to your computer and use it in GitHub Desktop.
A popover content sidebar designed to overlay prompt-style content on the side of the screen.
<!DOCTYPE html>
<!-- Alec M., 2021 -->
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Popover Sidebar</title>
<style>
html,
body {
margin: 0;
padding: 0;
font-family: sans-serif;
position: relative;
}
body {
background: #f2f2f2;
}
.popover {
position: fixed;
right: -530px;
top: 0;
bottom: 0;
width: 530px;
background: #fff;
border-left: 1px solid rgba(0, 0, 0, 0.1);
box-shadow: -5px 0 20px 0 rgba(66, 66, 66, 0.2);
transition: all 0.3s ease-in;
}
.popover.active {
right: 0;
}
.popover-title {
display: flex;
justify-content: center;
align-items: center;
height: 90px;
background: #3b3b3b;
color: #fff;
font-size: 21px;
padding: 0 25px;
}
.popover-title .title {
margin-right: auto;
}
.popover-title .times {
font-size: 33px;
cursor: pointer;
}
.content-preview {
width: calc(100% - 100px);
height: 250px;
background: #f2f2f2;
border: 1px solid rgba(0, 0, 0, 0.1);
box-sizing: border-box;
margin: 50px;
display: flex;
justify-content: center;
align-items: center;
user-select: none;
}
</style>
</head>
<body>
<div class='popover active'>
<div class='popover-title'>
<span class='title'>Customer Map</span>
<span class='times'>&times;</span>
</div>
<div class='popover-content'>
<div class='content-preview'>
...
</br>
content here
</br>
...
</div>
</div>
</div>
<script>
setInterval(function() {
document.querySelector('.popover').classList.add('active');
}, 2000);
</script>
</body>
</html>
@amattu2
Copy link
Author

amattu2 commented Feb 4, 2021

Preview

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment