Share Posted April 19, 2018 Hello, I tried create background slider where slides are stretched on window height and width. Snaps work good because i tried something similar but only in smaller dimensions. I think the problem is in the distance. Which must drag the element so that the slider changes its position to the next snap. I searched solution how can i decrease this distance. But i didn't find something. Thank you for answer. See the Pen RyNBjP?editors=0010 by SimkoDucko (@SimkoDucko) on CodePen Link to comment Share on other sites More sharing options...
Share Posted April 19, 2018 You can calculate snap using a function as in following demo, a lot more flexible when your slides are of same width. Idea is to use a container with width 100%, which becomes your "viewport" for slider. Then calculate width of your slides container by multiplying length and then use snap function to keep track of active slide so you can recalculate slides container on resize. See the Pen XqJxWK?editors=0010 by Sahil89 (@Sahil89) on CodePen 3 1 Link to comment Share on other sites More sharing options...
Author Share Posted April 19, 2018 Thank you Sahil. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now