I want to execute a function inside an iframe when the parent page element detects a scroll event and scrolltop is over 30.
I already fail at the first step which is correctly detecting scroll on dom which seems quite tricky with velo.
I’ve tried to follow this documentation:
but this is the result:
when removing the $(document) there is no error message but it doesn’t work.
The code snippets above were added to the velo code snipped of the current page and masterPage.js and they are correctly executed upon page load (I’ve tested it) but the scroll event listener doesn’t work.
Here I’ve read that velo can’t access the dom (can’t past the full url because there is a cap at 2)
forum.wixstudio .com/t/how-to-add-dom-in-lib/40320
and here the person uses document.addEventListener in 2023. I’m confused.
The code below will capture the current scroll position (window.pageYOffset) and pass it to the doSomething function when the user scrolls the page.
Remember to replace doSomething with your actual function name, and you can modify the doSomething function to implement the desired parallax effect for your container.
I hope this helps! Let me know if you have any further questions.
document.addEventListener(“scroll”, (event) => {
const lastKnownScrollPosition = window.pageYOffset;
doSomethin…
It seems impossible to archieve this in WIX.
Correct, it’s not possible to access the DOM.
That said, you might be able to achieve it with a custom element. When the element detects scroll, it dispatches an event that you can than action upon
Hi, @user6517 !!
It’s definitely possible to detect screen scrolling within a custom element.
Pratham
November 11, 2025, 6:12pm
4
And here’s an alternative solution without a custom element using just Velo:
Hey Alvaro,
That is correct, you cannot pin individual elements to the page in Studio as of now, like you can in the standard Wix editor. More on that below…
What does a form have to do with a Back To Top button? This is a totally incorrect reference.
As surprising as it may sound, creating a simple Back To Top button on Studio is rather painstaking and complex. This is because Studio for some reason does not allow us to set individual elements such as buttons as Global elements so that the…