I am currently trying to create a responsive carousel with varying amounts of items and widths/margins for which I am using Owl Carousel
Owl Carousel offers a great little option which allows you to specify how many items to show at a certain screen size in this fashion:
carousel.owlCarousel({
items : 4,
itemsDesktop : [1100,3],
itemsDesktopSmall : [700,2],
itemsTablet: [600,2],
itemsMobile : [400, 1]
});
So between window width of 700 and 1100 the carousel will show 3 items.
This is the basic structure my carousel item takes.
<div class="owl-item">
<div class="item">
ITEM CONTENT
</div>
</div>
Due to certain styling requirements there needs to be a percentage right hand margin on .item
I want to add this using media queries however as JS measures the width of the window and CSS media queries measure the width of the viewport, when there is a scrollbar present the values specified in my JS won't correlate with the CSS media query width.
Can anyone think of a solution to this? (Preferably without any heavy jquery)