Jump to content
Search Community

Slider issue on mobile.

truAscention test
Moderator Tag

Go to solution Solved by ZachSaucier,

Recommended Posts

Hi Zach,

 

So after your suggestion and stripping everything out, I found that I was calculating everything based on window.outerWidth which is what was throwing the slider off in terms of width. I also found that through my CSS the height was not being set correctly and it was defaulting to zero. 

 

So for those who run into this same problem, if you have your slider within a container with overflow hidden. Use that containers width and height for your slides. Then calculate the transform using the container width/height. Remember that transform starts at the current position and then moves the item to your desired output.

 

For example. If your slides slide in right to left and your starting postion is 100vw, calculate the negative position by -Math.abs(containerObj.width). Then to move it off the screen it will be -Math.abs(containerObj.width * 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.
×
×
  • Create New...