search

Home  >  Q&A  >  body text

How to hide scrollbars on mobile devices or emulators without affecting scrolling behavior in React app?

<p>On mobile devices, I would like to completely hide the scrollbars throughout the application, but I need the user to be able to scroll. </p> <p>I tried using CSS scrollbar, scrollbar-thumb, scrollbar-thumb:hover and scrollbar-track to hide the scrollbar, it works on the browser but not on mobile devices. </p>
P粉208286791P粉208286791470 days ago607

reply all(1)I'll reply

  • P粉896751037

    P粉8967510372023-08-18 11:08:31

    You need to use two CSS properties, one for webkit and another for Mozilla, as shown below -

    .invisible-scrollbar::-webkit-scrollbar {
      display: none;
    }
    
    .invisible-scrollbar {
      scrollbar-width: none;
    }
    

    Where .invisible-scrollbar is the class added to the related element.

    reply
    0
  • Cancelreply