| 1 |
<!DOCTYPE html> <title>Prevent Overflow Visual Test</title> |
| 2 |
|
| 3 |
<style> |
| 4 |
@import '/reset.css'; |
| 5 |
#scroll { |
| 6 |
position: relative; |
| 7 |
overflow: scroll; |
| 8 |
width: 584px; |
| 9 |
height: 584px; |
| 10 |
background-color: grey; |
| 11 |
} |
| 12 |
|
| 13 |
#scroll::before { |
| 14 |
content: 'before'; |
| 15 |
display: block; |
| 16 |
height: 2000px; |
| 17 |
width: 1px; |
| 18 |
} |
| 19 |
|
| 20 |
#scroll::after { |
| 21 |
content: 'after'; |
| 22 |
display: block; |
| 23 |
height: 2000px; |
| 24 |
width: 1px; |
| 25 |
} |
| 26 |
|
| 27 |
#reference { |
| 28 |
width: 200px; |
| 29 |
height: 200px; |
| 30 |
background-color: red; |
| 31 |
box-shadow: inset 0 0 0 1px black; |
| 32 |
position: relative; |
| 33 |
left: 200px; |
| 34 |
} |
| 35 |
|
| 36 |
#popper { |
| 37 |
width: 100px; |
| 38 |
height: 300px; |
| 39 |
background-color: rgba(200, 0, 255, 0.5); |
| 40 |
box-shadow: inset 0 0 0 1px black; |
| 41 |
} |
| 42 |
|
| 43 |
#arrow { |
| 44 |
width: 20px; |
| 45 |
height: 20px; |
| 46 |
background-color: yellow; |
| 47 |
} |
| 48 |
</style> |
| 49 |
|
| 50 |
<div id="scroll"> |
| 51 |
<div id="reference">Reference Box</div> |
| 52 |
<div id="popper">Popper Box</div> |
| 53 |
</div> |
| 54 |
|
| 55 |
<script type="module"> |
| 56 |
import { createPopper } from '../../dist/popper.js'; |
| 57 |
const reference = document.querySelector('#reference'); |
| 58 |
const popper = document.querySelector('#popper'); |
| 59 |
|
| 60 |
window.instance = createPopper(reference, popper, { |
| 61 |
placement: 'bottom', |
| 62 |
modifiers: [ |
| 63 |
{ |
| 64 |
name: 'flip', |
| 65 |
enabled: false, |
| 66 |
}, |
| 67 |
{ |
| 68 |
name: 'offset', |
| 69 |
options: { |
| 70 |
offset: [25, 25], |
| 71 |
}, |
| 72 |
}, |
| 73 |
{ |
| 74 |
name: 'preventOverflow', |
| 75 |
options: { |
| 76 |
altAxis: true, |
| 77 |
tether: true, |
| 78 |
}, |
| 79 |
}, |
| 80 |
], |
| 81 |
}); |
| 82 |
</script> |