document.addEventListener('DOMContentLoaded', () => {
// Run in Elementor editor (true=yes, false=no)
const OU_LENIS_RUN_IN_EDITOR = false;
// Easing smoothness (0.05=very smooth, 0.5=snappy)
const OU_LENIS_LERP = 0.1;
// Scroll sensitivity (0.5=slower, 1=fast)
const OU_LENIS_WHEEL = 0.7;
// Direction ("vertical", "horizontal", "both")
const OU_LENIS_ORIENTATION = "vertical";
// Debug logs (true=show, false=hide)
const OU_LENIS_DEBUG = false;
const inEditor =
document.body.classList.contains('elementor-editor-active') ||
(window.elementorFrontend?.isEditMode && window.elementorFrontend.isEditMode());
if (inEditor && !OU_LENIS_RUN_IN_EDITOR) return;
if (typeof window.Lenis !== 'function') return;
const lenis = new window.Lenis({
lerp: OU_LENIS_LERP,
wheelMultiplier: OU_LENIS_WHEEL,
gestureOrientation: OU_LENIS_ORIENTATION,
});
(function loop(t){
lenis.raf(t);
requestAnimationFrame(loop);
})(0);
document.addEventListener('click', e => {
const btn = e.target.closest('[ou-lenis]');
if (!btn) return;
const v = btn.getAttribute('ou-lenis');
if (v === 'stop') lenis.stop();
if (v === 'start') lenis.start();
});
});