Comments (4)
from swiper.
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()
from swiper.
Sorry...
is that code snippet for inside the idangerous.swiper-1.5.js ?
Or in the page body like
<script type="text/javascript">
var swiper = $('.swiper-container').swiper({
slidesPerSlide : 2,
})
</script>
from swiper.
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.
from swiper.
Related Issues (20)
- Customize pagination style
- Not looping smoothly with freeMode enabled
- swiper thumbs work differently depending on direction swiped.
- First image not loading initially in Swiper with dir="rtl" in Next.js HOT 1
- Virtual + loop with amount of slides less or equal to 3 leads to rendering duplicates
- maxBackfaceHiddenSlides parameter doesn't work when given less than 10 HOT 1
- `navigation-hide-on-click="true"` hides navigation when clicking nextEl/prevEl HOT 4
- Coverflow Effect Issue on new iOS Devices HOT 1
- `slidesPerView: "auto"` and virtual slides support HOT 1
- Slider backface hidden on updating the slides
- Thumbs Module not working on Strict Mode
- Can't swipe when swiper slides are clickable elements HOT 1
- react__WEBPACK_IMPORTED_MODULE_0__.createContext is not a function in Next.js 14.2.3 HOT 4
- Direction vertical, web components and it's fix HOT 1
- Ability to disable image lazy loading listeners HOT 9
- When using the horizontal mode of the scroll container, there are problems that are inconsistent with expectations. HOT 1
- swiper.slideTo(5) Jumps to Penultimate Image Instead of Last Image HOT 4
- Weird behavior of Swiper.js in Next.js 13 & 14 HOT 1
- slideTo animation gets cancelled when resizing browser window HOT 2
- Swiper appendSlide method doesn't work properly when virtual slides are enabled. (web-component) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiper.