-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoverflow-test.html
More file actions
135 lines (124 loc) · 4.49 KB
/
overflow-test.html
File metadata and controls
135 lines (124 loc) · 4.49 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Overflow Test - PivotPHP</title>
<style>
body {
margin: 0;
padding: 0;
font-family: -apple-system, sans-serif;
}
.debug-overlay {
position: fixed;
top: 0;
right: 0;
background: rgba(124, 58, 237, 0.9);
color: white;
padding: 10px;
z-index: 9999;
font-size: 12px;
border-radius: 0 0 0 8px;
}
.overflow-detector {
position: fixed;
top: 50%;
right: 0;
background: red;
color: white;
padding: 5px 10px;
transform: translateY(-50%);
display: none;
z-index: 9999;
}
.viewport-lines {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
pointer-events: none;
z-index: 9998;
}
.viewport-lines::before,
.viewport-lines::after {
content: '';
position: absolute;
background: rgba(255, 0, 0, 0.5);
width: 1px;
height: 100%;
top: 0;
}
.viewport-lines::before {
left: 0;
}
.viewport-lines::after {
right: 0;
}
</style>
</head>
<body>
<div class="debug-overlay">
<div>Viewport: <span id="viewport-width">0</span>px × <span id="viewport-height">0</span>px</div>
<div>Document: <span id="doc-width">0</span>px × <span id="doc-height">0</span>px</div>
<div>Overflow: <span id="overflow-status">None</span></div>
</div>
<div class="overflow-detector" id="overflow-detector">
⚠️ Horizontal Overflow Detected!
</div>
<div class="viewport-lines"></div>
<iframe src="/" style="width: 100%; height: 100vh; border: none;"></iframe>
<script>
function checkOverflow() {
const vw = window.innerWidth;
const vh = window.innerHeight;
const dw = document.documentElement.scrollWidth;
const dh = document.documentElement.scrollHeight;
document.getElementById('viewport-width').textContent = vw;
document.getElementById('viewport-height').textContent = vh;
document.getElementById('doc-width').textContent = dw;
document.getElementById('doc-height').textContent = dh;
if (dw > vw) {
document.getElementById('overflow-status').textContent = `Horizontal (${dw - vw}px)`;
document.getElementById('overflow-status').style.color = '#ff4444';
document.getElementById('overflow-detector').style.display = 'block';
// Find overflowing elements
findOverflowingElements();
} else {
document.getElementById('overflow-status').textContent = 'None';
document.getElementById('overflow-status').style.color = '#44ff44';
document.getElementById('overflow-detector').style.display = 'none';
}
}
function findOverflowingElements() {
const all = document.querySelectorAll('*');
const vw = window.innerWidth;
console.group('Overflowing Elements:');
all.forEach(el => {
const rect = el.getBoundingClientRect();
if (rect.right > vw || rect.left < 0) {
console.log({
element: el,
tagName: el.tagName,
className: el.className,
width: rect.width,
right: rect.right,
overflow: rect.right - vw
});
}
});
console.groupEnd();
}
checkOverflow();
window.addEventListener('resize', checkOverflow);
// Test different viewport sizes
console.log('Testing different viewport sizes...');
const sizes = [320, 375, 414, 768, 1024, 1280];
sizes.forEach(size => {
console.log(`Testing ${size}px width...`);
// Would need to actually resize window or use puppeteer for real testing
});
</script>
</body>
</html>