Skip to content

Instantly share code, notes, and snippets.

@FezVrasta
Created April 29, 2020 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FezVrasta/11b807834b33667c5d6d5422f0f6258c to your computer and use it in GitHub Desktop.
Save FezVrasta/11b807834b33667c5d6d5422f0f6258c to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<style>
body {
display: flex;
}
.push {
width: 2000px;
height: 200px;
background: gray;
flex-shrink: 0;
}
#popcorn {
width: 200px;
height: 200px;
background: green;
display: inline-block;
flex-shrink: 0;
}
#tooltip {
background-color: #333;
color: white;
padding: 5px 10px;
border-radius: 4px;
font-size: 13px;
}
</style>
</head>
<body>
<div class="push"></div>
<div id="popcorn"></div>
<div id="tooltip">
tooltip
</div>
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script>
const popcorn = document.querySelector('#popcorn');
const tooltip = document.querySelector('#tooltip');
Popper.createPopper(popcorn, tooltip, {
placement: 'top',
modifiers: [
{
name: 'preventOverflow',
options: {
tether: false,
},
},
],
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment