aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.mjs')
-rw-r--r--src/utils.mjs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/utils.mjs b/src/utils.mjs
index c9a2457..ffd8978 100644
--- a/src/utils.mjs
+++ b/src/utils.mjs
@@ -88,6 +88,11 @@ export function throttle (func, delay) {
88 } 88 }
89} 89}
90 90
91/**
92 * shiftByWindow. make sure HTMLElement inside viewport
93 *
94 * @param {HTMLElement} element
95 */
91export const shiftByWindow = element => { 96export const shiftByWindow = element => {
92 const rect = element.getBoundingClientRect() 97 const rect = element.getBoundingClientRect()
93 const offsetX = window.innerWidth - rect.left - rect.width 98 const offsetX = window.innerWidth - rect.left - rect.width