Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
nicolaseielll

How to switch normalizeScroll to false on mobile devices

Recommended Posts

I have smooth scroll configured to my project but the scroll gets laggy on mobile devices if normalizeScroll is set to true so I was wondering if there's a way to switch it to false if user is on a mobile device.

 

I tried this and it changes the boolean but the normalizeScroll wont switch conditionally.

if(window.innerWidth < 960) {
  this.normalizeScroll = false
} else {
  this.normalizeScroll = true
}
this.$scrollSmoother.refresh()

Here's a codesandbox with the same setup I have in my project: https://codesandbox.io/s/gifted-sea-6rybt5?file=/layouts/default.vue

Link to comment
Share on other sites

Hey there Nicolas,

 

You can use media queries like so.

 

Good luck with your project!

See the Pen GRQENyo by GreenSock (@GreenSock) on CodePen

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

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

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×