Skip to main content
MarkSmit
Inspiring
November 10, 2022
Answered

Is it possible to disable scroll?

  • November 10, 2022
  • 2 replies
  • 1141 views

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 has been closed for replies.
    Correct answer MarkSmit

    This is my current fix:

     

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

    2 replies

    kglad
    Community Expert
    November 10, 2022
    MarkSmit
    MarkSmitAuthorCorrect answer
    Inspiring
    November 11, 2022

    This is my current fix:

     

    <script>
      setTimeout(()=> document.body.classList.remove('your-class') ,4000);
     </script>
    kglad
    Community Expert
    November 11, 2022

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

    JoãoCésar17023019
    Community Expert
    November 10, 2022

    Hi.

     

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

     

    Please let us know.

     

    Regards,

    JC

    MarkSmit
    MarkSmitAuthor
    Inspiring
    November 11, 2022

    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.