PluginProbe ʕ •ᴥ•ʔ
Hostinger Reach – AI-Powered Email Marketing for WordPress / 1.7.1
Hostinger Reach – AI-Powered Email Marketing for WordPress v1.7.1
1.7.1 1.7.0 1.6.0 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 trunk 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6
hostinger-reach / frontend / vue / composables / useScrollLock.ts
hostinger-reach / frontend / vue / composables Last commit date
index.ts 1 year ago useAmplitudeEvent.ts 3 months ago useHostingData.ts 3 months ago useModal.ts 1 year ago useOverviewData.ts 9 months ago useReachUrls.ts 1 month ago useScrollLock.ts 11 months ago useServerPagination.ts 10 months ago useToast.ts 1 year ago
useScrollLock.ts
44 lines
1 import { ref } from 'vue';
2
3 const scrollLockCount = ref(0);
4 const originalBodyStyles = ref<{
5 overflow: string;
6 paddingRight: string;
7 } | null>(null);
8
9 export const useScrollLock = () => {
10 const lockScroll = () => {
11 scrollLockCount.value++;
12
13 if (scrollLockCount.value === 1) {
14 originalBodyStyles.value = {
15 overflow: document.body.style.overflow,
16 paddingRight: document.body.style.paddingRight
17 };
18
19 const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
20
21 document.body.style.overflow = 'hidden';
22 if (scrollbarWidth > 0) {
23 document.body.style.paddingRight = `${scrollbarWidth}px`;
24 }
25 }
26 };
27
28 const unlockScroll = () => {
29 scrollLockCount.value = Math.max(0, scrollLockCount.value - 1);
30
31 if (scrollLockCount.value === 0 && originalBodyStyles.value) {
32 document.body.style.overflow = originalBodyStyles.value.overflow;
33 document.body.style.paddingRight = originalBodyStyles.value.paddingRight;
34 originalBodyStyles.value = null;
35 }
36 };
37
38 return {
39 lockScroll,
40 unlockScroll,
41 isLocked: () => scrollLockCount.value > 0
42 };
43 };
44