Skip to content

Commit 9eb2cdc

Browse files
don't add scrollbar to both html and body element
1 parent 89f21b8 commit 9eb2cdc

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

assets/src/css/dashboard.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
html, body { height: 100%; overflow-y: scroll; }
2-
31
/* standalone specific styles */
42
body.ka-dashboard {
53
background: #f1f1f1;
64
color: #3c434a;
75
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
86
font-size: 14px;
97
line-height: 1.5;
8+
margin: 0;
9+
overflow-y: scroll;
10+
padding: 12px;
1011
}
1112
.ka-dashboard a {
1213
color: #3858e9;

assets/src/js/imports/chart.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if (chart) {
2020
tooltip.querySelector('.ka--pageviews').children[0].textContent = data.pageviews;
2121

2222
// set tooltip position relative to top-left of document
23+
var availWidth = document.body.clientWidth;
2324
tooltip.style.display = 'block';
2425
var scrollY = window.pageYOffset !== undefined ? window.pageYOffset : window.scrollTop
2526
var scrollX = 0; //window.pageXOffset !== undefined ? window.pageXOffset : window.scrollLeft
@@ -29,10 +30,10 @@ if (chart) {
2930
var offCenter = 0;
3031

3132
// if tooltip goes off the screen, position it a bit off center
32-
if (left < 6) {
33-
offCenter = -left + 6;
34-
} else if (left + tooltip.clientWidth > document.body.clientWidth - 6) {
35-
offCenter = document.body.clientWidth - (left + tooltip.clientWidth) + 6;
33+
if (left < 12) {
34+
offCenter = -left + 12;
35+
} else if (left + tooltip.clientWidth > availWidth - 12) {
36+
offCenter = availWidth - (left + tooltip.clientWidth) - 12;
3637
}
3738

3839
// shift tooltip to the right (or left)

0 commit comments

Comments
 (0)