From a89940331b219d7cf49578dfdf7d888c6d500479 Mon Sep 17 00:00:00 2001 From: Kai Piper Date: Fri, 15 Dec 2023 16:30:23 +0000 Subject: [PATCH] Update scrollwheelgen.html --- scrollwheelgen.html | 218 ++++++++++++++++++++++++-------------------- 1 file changed, 120 insertions(+), 98 deletions(-) diff --git a/scrollwheelgen.html b/scrollwheelgen.html index 52229be..93aa486 100644 --- a/scrollwheelgen.html +++ b/scrollwheelgen.html @@ -1,9 +1,7 @@ - - - - + + Modern Custom Scrollbar Generator -
+
`; + document.getElementById('code-box').textContent = code; + updatePreview(); + } + + function updatePreview() { + previewScrollContainer.style.width = widthInput.value; + previewScrollContainer.style.height = heightInput.value; + previewScrollContainer.style.borderRadius = borderRadiusInput.value; + previewScrollContainer.style.boxShadow = boxShadowInput.value; + previewScrollContainer.style.background = backgroundInput.value; + previewScrollContainer.style.setProperty('--scrollbar-width', barWidthInput.value); + previewScrollContainer.style.setProperty('--scrollbar-background', barBackgroundInput.value); + + if (gradientToggle.checked) { + const lighterColor = adjustColor(backgroundInput.value, 40); + const darkerColor = adjustColor(backgroundInput.value, -40); + previewGradientContainer.style.background = `linear-gradient(to right, ${lighterColor}, ${darkerColor})`; + } else { + previewGradientContainer.style.background = backgroundInput.value; + } } function saveSettings() { @@ -276,11 +296,11 @@

Custom Scrollbar Generator

height: heightInput.value, borderRadius: borderRadiusInput.value, background: backgroundInput.value, - barWidth: barWidthInput.value, - barBackground: barBackgroundInput.value, boxShadow: boxShadowInput.value, gradient: gradientToggle.checked, - wheelSettings: wheelSettingsInput.value, + scrollBehavior: scrollBehaviorSelect.value, + barWidth: barWidthInput.value, + barBackground: barBackgroundInput.value, }; localStorage.setItem('customScrollbarSettings', JSON.stringify(settings)); @@ -295,18 +315,20 @@

Custom Scrollbar Generator

heightInput.value = settings.height; borderRadiusInput.value = settings.borderRadius; backgroundInput.value = settings.background; - barWidthInput.value = settings.barWidth; - barBackgroundInput.value = settings.barBackground; boxShadowInput.value = settings.boxShadow; gradientToggle.checked = settings.gradient; - wheelSettingsInput.value = settings.wheelSettings; + scrollBehaviorSelect.value = settings.scrollBehavior; + barWidthInput.value = settings.barWidth; + barBackgroundInput.value = settings.barBackground; applyStyles(); } } loadSettings(); // Load settings on page load + setInterval(updatePreview, 1000); // Update preview every second - - + + +