Jump to content

Disable scrolling on desktop only?

Go to solution Solved by tuanphan,

Recommended Posts

Site URL: https://www.longevitycollective.com/newsletter

I am trying to disable scrolling on desktop only on one page (I want to still be able to scroll on mobile). Here is the code I added to the header to disable scrolling:

  html, body {width: 100% !important; height: 100% !important; overflow: hidden !important}

I've only been able to find posts about completely disabling desktop and mobile, or just mobile only. How can I fix this?

Link to comment
4 hours ago, afabella said:

Site URL: https://www.longevitycollective.com/newsletter

I am trying to disable scrolling on desktop only on one page (I want to still be able to scroll on mobile). Here is the code I added to the header to disable scrolling:

  html, body {width: 100% !important; height: 100% !important; overflow: hidden !important}

I've only been able to find posts about completely disabling desktop and mobile, or just mobile only. How can I fix this?

Use media query 

@media only screen and (max-width: 768px) {
   
}

 

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
  • Solution
On 7/21/2021 at 2:52 AM, afabella said:

@tuanphan I meant disable scroll (on desktop only, not mobile). The code didn't work for me unfortunately. Any other suggestions?

Edit this code

 html, body {width: 100% !important; height: 100% !important; overflow: hidden !important}

to this

 html, body {width: 100% !important; height: 100% !important;}
@media screen and (min-width:992px) {
	html, body {
		overflow: hidden;
}
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.