-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Styling troubles #23
Comments
Hi Jay. Don't set margins on slides! It will not work. If you need visible margins between slides, add some container inside of slide and set margins/paddings to this elements. Also you can't set single slide's width, Swiper calculates it automatically. To have more than one slide pers swiper-container you need to use slidesPerSlide parameter on initialization. For example your swiper-container width is 640px, and if you set slidesPerSlide equal to "2", then each slide will be 640/2 = 320 px wide. Also, you can change this parameter dynamically after Swiper initialization like: var swiper = $('.swiper-container').swiper({ ... slidesPerSlide : 2, ... }) // And then you can change it, for example if your container became wider and you can fit there 3 slides: swiper.params.slidesPerSlide = 3; // Re-init slider to apply new settings: swiper.init() |
Sorry... Or in the page body like
|
slidesPerSlide is the parameter that you should add when you initialize your Swiper, i suppose you do in body or in included JS script. That code snippet above is just the example of Swiper initialization that of course should be in your scripts/body and executed on document/window ready. |
Can you help me to understand what I'm experiencing?
idangerous.swiper-1.5.css
Slider size defined as 100% wide by 260px tall
mypage.html (temp inline styles)
body width matching slider width
.myslide class 300px wide by 148px tall with margins 20 10 20 0
What I get:
slides variable width wide by 240px tall with a 20px margin above (and presumably below), and 10px margin between slides
If I define the slider width & body width as 640px wide instead of 100% I get
213px wide by 240px tall with a 20px margin above (and presumably below), and 10px margin between slides
The text was updated successfully, but these errors were encountered: