Skip to main content
MarkSmit
Inspiring
Nov 10, 2022 7:20 PM UTC
Answered

Is it possible to disable scroll?

Is there a line of code that can disable scrolling? I have an html animation in an iframe and it would be nice if scrolling would be turned off in the beginning and I can enable it at the end of the animation.

    This topic is closed to new replies. Start a new post to keep the conversation going.
    MarkSmit
    MarkSmitCorrect answer
    Inspiring
    Nov 11, 2022 8:17 AM UTC

    This is my current fix:

     

    <script>
      setTimeout(()=> document.body.classList.remove('your-class') ,4000);
     </script>

    7 replies

    kglad
    Community Expert
    Community Expert
    Nov 10, 2022 9:29 PM UTC
    MarkSmit
    MarkSmitAuthorCorrect answer
    Inspiring
    Nov 11, 2022 8:17 AM UTC

    This is my current fix:

     

    <script>
      setTimeout(()=> document.body.classList.remove('your-class') ,4000);
     </script>
    Translate
    kglad
    Community Expert
    Community Expert
    Nov 11, 2022 3:20 PM UTC

    i'm not sure that makes any sense without seeing the html.

    Translate
    JoãoCésar17023019
    Community Expert
    Community Expert
    Nov 10, 2022 9:15 PM UTC

    Hi.

     

    Did you try to set the CSS overflow property on the iframe to hidden?

     

    Please let us know.

     

    Regards,

    JC

    Translate
    MarkSmit
    MarkSmitAuthor
    Inspiring
    Nov 11, 2022 8:14 AM UTC

    That could be a solution. But that means the scroll stays disabled, right? At the end of the animation I need it to scroll again. My current fix is a 'scroll disable timer'. After 4 seconds of being on the webpage, scroll is enabled. It works but isn't really reliable. On the mobile version I just added 'createjs.Touch.enable(stage);' at the first frame and 'createjs.Touch.disable(stage);' at the last.

    Translate