diff --git a/src/lib/getElements.ts b/src/lib/getElements.ts index 068e70c..670223a 100644 --- a/src/lib/getElements.ts +++ b/src/lib/getElements.ts @@ -204,3 +204,6 @@ export const getGridFields = ( export const getGridPreview = (attribute: string): HTMLElement => document.getElementById(`${attribute}-preview`) as HTMLElement; + +export const getScrollPreview = (): HTMLElement => + document.getElementById('scroll-preview') as HTMLElement; diff --git a/src/pages/scroll.ts b/src/pages/scroll.ts index a6c0c9e..df68186 100644 --- a/src/pages/scroll.ts +++ b/src/pages/scroll.ts @@ -5,6 +5,7 @@ import { getCopyCodeButton, getCssOrTailwindButton, getCssOrTailwindDropdown, + getScrollPreview, } from '../lib/getElements'; import {closeDropdown, showPopup} from '../lib/packages/utils'; @@ -83,9 +84,7 @@ function copyHandler(values: Values) { } export function scrollGenerator() { - const previewElement = document.getElementById( - 'scroll-preview' - ) as HTMLElement; + const previewElement = getScrollPreview(); function applyPreviewStyles(values: Values) { if (!previewElement) return;