Jump to content

Disable Zoom-in / Zoom-out on a mobile

Go to solution Solved by tuanphan,

Recommended Posts

On 9/3/2024 at 11:06 PM, Remilp said:

Hello community,

On my website (mobile version) I would like to disable the ability of zoom-out or zoom-in. 

Do you guys have an idea of the code I need to lock this fonction ?

Thanks !

Hey could you try adding this to header

<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

`user-scalable=no` stops the zooming

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 No-code customisations for Squarespace (+100 Spark plugin customisations)
🥳 Freemium Squarespace Widget Templates (+1000 Elfsight 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 9/9/2024 at 9:46 PM, Remilp said:

Hello

Thanks for your answer but it still don't work 😕

@tuanphan maybe you have a solution ?

Try this to Code Injection > Header

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<style>
  html, body {
    touch-action: pan-x pan-y;
    -ms-touch-action: pan-x pan-y;
}

</style>
<script>
  document.addEventListener('gesturestart', function (e) {
    e.preventDefault();
});

</script>

 

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.