flipWithoutPreventOverflow.html
1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html>
<head>
<style>
.reference {
background:#ff0000;
width:150px;
height:150px;
border:1px solid red;
}
.popper {
background:black;
width:50px;
height:50px;
color:#fff;
}
.scrollable {
width:400px;
height:300px;
overflow:scroll;
border:1px solid red;
}
.reference-container {
width:300%;
height:300%;
background:yellow;
display:flex;
justify-content:center;
align-items:center;
}
</style>
</head>
<body>
<div class="scrollable" id="boundaries">
<div class="reference-container">
<div class="reference"></div>
</div>
</div>
<div class="popper">test popper</div>
<script src="../../dist/popper.js"></script>
<script>
var reference = document.querySelector('.reference');
var popperElem = document.querySelector('.popper');
var thePopper = new Popper(
reference,
popperElem,
{
placement: 'right-start',
boundariesElement: boundaries,
modifiers: {
preventOverflow: {
enabled: true,
escapeWithReference: true
},
flip: {
flipVariations: true
}
}
}
);
</script>
</body>
</html>