Owl Carousel not working in bootstrap modal - html

I have a parent page where I have a block of the list and in each list, I have images where on the image div I have implemented Owl Carousel and it is working fine.On each list the there is a button on clicking the button a modal will open and I want to implement Owl Carouse there but in the modal Owl carousel is not working as expected.
In main page I have implement Owl like this
$(".owl-carousel").owlCarousel({
loop: false,
autoPlay: false,
stopOnHover: false,
navigation: true,
pagination: false,
paginationNumbers: false,
responsiveClass: true,
//loop: true,
//margin: 10,
//nav: true,
responsive: {
0: {
items: 2
},
600: {
items: 2
},
1000: {
items: 3
},
1360: {
items: 3
}
}
});
And in Modal I have implemented Owl like this
$('#package-details').on('shown.bs.modal',
function () {
debugger;
$("#pckg-app-list").owlCarousel({
loop: false,
autoPlay: false,
stopOnHover: false,
navigation: true,
pagination: false,
paginationNumbers: false,
responsiveClass: true,
responsive: {
0: {
items: 2
},
600: {
items: 2
},
1000: {
items: 3
},
1360: {
items: 3
}
}
});
});
In modal Owl is generated this way in HTML which is wrong because there is no outer elemnt applying.
<div class="owl-carousel owl-theme yesscroll px-0 owl-loaded owl-drag" id="pckg-app-list"><div class="item"> <img class="owlimage" src="https://appsdrive.blob.core.windows.net/applogos/aeb6cee7-3951-4fe6-af63-f656b2a8bdb9_SAp-business-one.png"> </div><div class="item"> <img class="owlimage" src="https://appsdrive.blob.core.windows.net/applogos/3334f37d-bd1e-419a-89bc-28544ddb4e8c_magento.png"> </div></div>

function showModal() {
$('.modal').on('show.bs.modal', function (event) {
$('.owl-carousel').owlCarousel({
loop: true,
margin: 10,
nav: true,
navText: [
"<i class='fa fa-caret-left'></i>",
"<i class='fa fa-caret-right'></i>"
],
autoplay: true,
autoplayHoverPause: true,
responsive: {
0: {
items: 1
},
600: {
items: 3
},
1000: {
items: 5
}
}
})
})
$(".modal").modal("show");
}
.carousel-wrap {
margin: 90px auto;
padding: 0 5%;
width: 80%;
position: relative;
}
/* fix blank or flashing items on carousel */
.owl-carousel .item {
position: relative;
z-index: 100;
-webkit-backface-visibility: hidden;
}
/* end fix */
.owl-nav > div {
margin-top: -26px;
position: absolute;
top: 50%;
color: #cdcbcd;
}
.owl-nav i {
font-size: 52px;
}
.owl-nav .owl-prev {
left: -30px;
}
.owl-nav .owl-next {
right: -30px;
}
.btn-modal-close {
width: 32px;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.1/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.1.3/assets/owl.carousel.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script src="https://use.fontawesome.com/826a7e3dce.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.1.3/owl.carousel.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#4.6.1/dist/js/bootstrap.bundle.min.js"></script>
<a class="btn btn-primary" href="javascript:void(0);" onclick="showModal()">Click Here</a>
<div class="modal" tabindex="-1">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-body">
<div class="d-flex justify-content-center mb-2 justify-content-md-end">
<button type="button" class="close btn-modal-close" data-dismiss="modal" aria-label="Close">
<span>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29.24 29.24">
<g fill="none" stroke="#52bbab" stroke-miterlimit="10">
<path d="m28.22 28.88-27.87-27.86" />
<path d="m.35 28.88 28.53-28.53" />
</g>
</svg>
</span>
</button>
</div>
<div class="container-fluid">
<div class="carousel-wrap">
<div class="owl-carousel">
<div class="item"><img src="http://placehold.it/150x150"></div>
<div class="item"><img src="http://placehold.it/150x150"></div>
<div class="item"><img src="http://placehold.it/150x150"></div>
<div class="item"><img src="http://placehold.it/150x150"></div>
<div class="item"><img src="http://placehold.it/150x150"></div>
<div class="item"><img src="http://placehold.it/150x150"></div>
<div class="item"><img src="http://placehold.it/150x150"></div>
<div class="item"><img src="http://placehold.it/150x150"></div>
<div class="item"><img src="http://placehold.it/150x150"></div>
<div class="item"><img src="http://placehold.it/150x150"></div>
<div class="item"><img src="http://placehold.it/150x150"></div>
<div class="item"><img src="http://placehold.it/150x150"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

Related

Using two (owl) carousel on a single page is not working

I am trying to use two owl carousels on my page but I can't.
Gif: https://gyazo.com/51620bc2fa6183bdcaab511632e1eb57
The first one is working perfectly (the one in the top on the gif)
but the second one (the one below on the gif) is not working. It is set to show 4 images instead of the 2 I set. I don't know what to do
This one is working well:
<body>
<!-- MENU-->
<section>
<div class="owl-carousel owl-theme">
<div class="item">
<img src="img/image1.jpg">
</div>
<div class="item">
<img src="img/image2.jpg">
</div>
<div class="item">
<img src="img/image3.jpg">
</div>
<div class="item">
<img src="img/image4.jpg">
</div>
<div class="item">
<img src="img/image5.jpg">
</div>
<div class="item">
<img src="img/image6.jpg">
</div>
<div class="item">
<img src="img/image7.jpg">
</div>
<div class="item">
<img src="img/image8.jpg">
</div>
<div class="item">
<img src="img/image9.jpg">
</div>
</div>
<!--script MENU-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js" integrity="sha512-bPs7Ae6pVvhOSiIcyUClR7/q2OAsRiovw4vAkX+zJbw3ShAeeqezq50RIIcIURq7Oa20rW2n2q+fyXBNcU9lrw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
$(document).ready(function(){
$(".owl-carousel").owlCarousel({
loop:true,
responsive: {
0 : {
items : 1
},
600 : {
items : 2
},
1200 : {
items : 4
}
},
autoplay: true,
autoplayTimeout: 1500
});
})
</script>
</section>
But this one is not working well:
<header>
<div class="owl-carousel owl-theme">
<div class="item"><img src="/img/Group 1.jpg" alt="slide1" /></div>
<div class="item"><img src="/img/Group 2.jpg" alt="slide1" /></div>
</div>
<script>
$('.owl-carousel').owlCarousel({
loop:true,
margin:0,
nav:true,
dots:true,
responsive:{
0:{
items:1
},
600:{
items:1
},
1000:{
items:1
}
}
})
</script>
<!--Script HEADER-->
<script src="https://owlcarousel2.github.io/OwlCarousel2/assets/vendors/jquery.min.js"></script>
<script src="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/owl.carousel.js"></script>
</header>
Href Menu:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css" integrity="sha512-tS3S5qG0BlhnQROyJXvNjeEM4UpMXHrQfTGmbQ1gKmelCxlSEBUaxhRBj/EFTzpbP4RVSrpEikbmdJobCvhE3g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.theme.default.min.css" integrity="sha512-sMXtMNL1zRzolHYKEujM2AqCLUR9F2C4/05cdbxjjLSRvMQIciEPCQZo++nk7go3BtSuK9kfa/s+a4f4i5pLkw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
Href Header:
<link rel="stylesheet" href="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/assets/owl.carousel.min.css">
<link rel="stylesheet" href="https://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/assets/owl.theme.default.min.css">
Css(header):
*{ margin:0; padding:0; box-sizing:border-box}
body {
background-color: #fff;
}
.item img{ height:450px; width:100%; object-fit:cover}
.owl-nav {
position: absolute;
top: 50%;
transform: translateY(-50%);
z-index: 9999;
width: 100%;
}
.owl-nav button {
background: #fff !important;
width: 50px;
height: 50px;
display: block
}
.owl-nav button.owl-next {
float: right;
}
.owl-nav button.owl-prev {
float: left;
}
.owl-dots {
position: absolute;
bottom: 5%;
left: 0;
right: 0;
}
Both scripts with which you run the carousel are looking for a block with a class ".owl-carousel" and find them both. So, we have conflict. Both carousels initialized by every script snippets, but with diferent options.
You must be better - add diferent ID to every carousel and inintialize them separately (individually):
<div id="carousel-1" class="owl-carousel owl-theme">
...
</div>
<div id="carousel-2" class="owl-carousel owl-theme">
...
</div>
<script>
$("#carousel-1").owlCarousel({
items: 4,
...
});
</script>
<script>
$("#carousel-2").owlCarousel({
items: 2,
...
});
</script>

responsive Masonry/Packary overlaps over other images and DOM elements

I have been working on several things related to this for hours now. I finally got it to work, but somehow it broke again. So here I am.
For my use-case I want to display images with Packery. The images have to sort themselves so that the grid has no gaps. The user will be able to choose the sizing of the images inside the grid, and the grid should sort accordingly.
With every method that I've tried, they display over the rest of the page, or stack on top of each other.
I tested this with Masonry, Packery and Isotope. All give the same results.
My code sample below is of the Packery attempt.
Edit: After more testing, I figured out that this issue only occurs when combining height and width classes. When only one of those is present, no overlapping occurs. I do need this functionality though.
The blue line shows where the images should end.
$(document).ready(function() {
let $grid = $('.grid').imagesLoaded(function() {
// init Packery after all images have loaded
$('.grid').packery({
itemSelector: '.grid-item',
percentPosition: true
});
$grid.packery('layout');
});
// I have also tried this approach
let $grid = $('.grid').packery({
itemSelector: '.grid-item',
percentPosition: true
});
// layout Packery after each image loads
$grid.imagesLoaded().progress(function() {
$grid.packery();
});
});
* {
box-sizing: border-box;
}
/* force scrollbar, prevents initial gap */
html {
overflow-y: scroll;
}
body {
font-family: sans-serif;
}
/* ---- grid ---- */
.grid {
background: #DDD;
}
/* clear fix */
.grid:after {
content: '';
display: block;
clear: both;
}
/* ---- .element-item ---- */
/* 5 columns, percentage width */
.grid-item {
float: left;
width: 16.667%;
height: 200px;
}
.grid-item img {
display: block;
width: 100%;
height: 100%;
}
.grid-item--small-width {
width: 16.667%;
}
/*Small*/
.grid-item--double-small-width {
width: 33.334%;
}
/*Double*/
.grid-item--half-width {
width: 50%;
}
/*Half*/
.grid-item--three-fourth-width {
width: 66.668%;
}
/*Bit More Than Half*/
.grid-item--big-width {
width: 83.335%;
}
/*Big*/
.grid-item--full-width {
width: 100%;
}
/*Full*/
.grid-item--small-height {
height: 16.667%;
}
/*Small*/
.grid-item--double-small-height {
height: 33.334%;
}
/*Double*/
.grid-item--half-height {
height: 50%;
}
/*Half*/
.grid-item--three-fourth-height {
height: 66.668%;
}
/*Bit More Than Half*/
.grid-item--big-height {
height: 83.335%;
}
/*Big*/
.grid-item--full-height {
height: 100%;
}
/*Full*/
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/masonry.classes.css">
<section>
<div class="container-fluid text-center" style="background-color: white; color: black">
<div class="container" style="margin-bottom: 20px">
<div class="row">
<h1>Portfolio</h1>
<div class="col-md-12">
<div class="grid" style="height: 1200px;">
<div class="grid-sizer"></div>
<div class="grid-item grid-item--small-width grid-item--full-height"><img class="img-responsive" src="http://landstededev.test/storage/projects/projectImage_4.png"></div>
<div class="grid-item grid-item--small-width grid-item--half-height"><img class="img-responsive" src="http://landstededev.test/storage/projects/projectImage_4.png"></div>
<div class="grid-item grid-item--small-width grid-item--small-height"><img class="img-responsive" src="http://landstededev.test/storage/projects/projectImage_4.png"></div>
<div class="grid-item grid-item--small-width grid-item--small-height"><img class="img-responsive" src="http://landstededev.test/storage/project/projectImage_4.png"></div>
<div class="grid-item grid-item--full-width grid-item--small-height"><img class="img-responsive" src="http://landstededev.test/storage/projects/projectImage_4.png"></div>
<div class="grid-item grid-item--small-width grid-item--small-height"><img class="img-responsive" src="http://landstededev.test/storage/projects/projectImage_4.png"></div>
<div class="grid-item grid-item--small-width grid-item--small-height"><img class="img-responsive" src="http://landstededev.test/storage/projects/projectImage_4.png"></div>
<div class="grid-item grid-item--small-width grid-item--small-height"><img class="img-responsive" src="http://landstededev.test/storage/projects/projectImage_4.png"></div>
<div class="grid-item grid-item--small-width grid-item--small-height"><img class="img-responsive" src="http://landstededev.test/storage/projects/projectImage_4.png"></div>
<div class="grid-item grid-item--small-width grid-item--small-height"><img class="img-responsive" src="http://landstededev.test/storage/projects/projectImage_4.png"></div>
</div>
</div>
</div>
</div>
</div>
</section>
<section>
<div class="container-fluid" style="background-color: #f0f0f0; color: #121212">
<div class="container">
<div class="row align-items-center justify-content-center">
<div class="col-4 text-center">
Link To Twitter
<br>
</div>
<div class="col-8" style="border-left: 2px solid #121212">
<h2 class="title">Title</h2>
<p>Some description will go here</p>
</div>
</div>
</div>
</div>
</section>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/packery#2.1.2/dist/packery.pkgd.min.js"></script>
<script src="https://unpkg.com/imagesloaded#4/imagesloaded.pkgd.min.js"></script>
The javascript does not work with or without the $grid.packery('layout'); part. I have this here because it fixed an issue I had before.
After experimenting for a few more hours, I figured out that it is not possible to combine width and height classes that both use percentages.
I now use percentages for width only. Height now uses fixed px values.

Get properly sized brand logos in a carousel

I'm trying to achieve an automatic resizing of different brand logos for a company website I'm designing, inside an Own Carousel. The idea is for each logo to be of reasonable size.
Most of the logos are in SVG formats, available at https://wetransfer.com/downloads/44eb123d186e30519edc2d025dafd03420200110231646/112373 (for a week) : as you would see, they have a wide range of height / width ratio, so using a fixed-width and enforcing the correct ratio made some of them (the CNRS and CEA logos) too high.
The goal (taken from a random site):
The goal
What I got:
What I got
My code (HTML, then CSS based on Bootstrap 4, then the JS snippet that uses owl-carousel):
<div class="site-section">
<div class="container">
<div class="row justify-content-center text-center mb-5">
<div class="col-md-5">
<h2 class="section-heading">Ils nous ont fait confiance</h2>
</div>
</div>
<div class="row justify-content-center text-center">
<div class="col">
<div class="owl-carousel clients-carousel">
<img src="./img/clients/airbus-group.svg" class="client-logo limit-width" />
<img src="./img/clients/safran-group.png" class="client-logo limit-width" />
<img src="./img/clients/cnrs-fr.svg" class="client-logo limit-height" />
<img src="./img/clients/cea-fr.svg" class="client-logo limit-height" />
<img src="./img/clients/bic.svg" class="client-logo limit-width" />
<img src="./img/clients/edf.svg" class="client-logo limit-width" />
<img src="./img/clients/horiba.svg" class="client-logo limit-width" />
<img src="./img/clients/jenoptec-group.svg" class="client-logo limit-width" />
<img src="./img/clients/otis.svg" class="client-logo limit-width" />
<img src="./img/clients/thales.svg" class="client-logo limit-width" />
</div>
</div>
</div>
</div>
</div>
.clients-carousel .owl-stage-outer, .clients-carousel .owl-stage, .clients-carousel .owl-item {
display: flex;
}
.clients-carousel .owl-item {
margin-left: 1rem;
margin-right: 1rem;
}
.clients-carousel .owl-item img.client-logo {
width: 15em;
height: auto;
}
var siteOwlCarousel = function() {
$('.clients-carousel').owlCarousel({
center: true,
items: 3,
loop: true,
margin: 0,
autoplay: true,
smartSpeed: 1000,
nav:false,
dots:false,
autoWidth:true,
responsive: {
// breakpoint from 0 up
0 : {
items: 3
},
// breakpoint from 576 up
576 : {
items: 3
},
// breakpoint from 768 up
768 : {
items: 4,
center: false
},
992 : {
items: 4,
center: false
},
1200 : {
items: 4,
center: false
}
}
});
};
siteOwlCarousel();
Would somebody have an idea that relies on Flexbox?
Thanks in advance!
choumat
Change .owl-wrapper display property and owl-item display, float, vertical-align properties and set to max- width & height size.
I hope below snippet will help you lot.
var siteOwlCarousel = function() {
$('.clients-carousel').owlCarousel({
center: true,
items: 3,
loop: true,
margin: 10,
autoplay: true,
smartSpeed: 1000,
nav: false,
dots: false,
autoWidth: true,
responsive: {
0 : {
items: 2
},
576 : {
items: 3
},
768 : {
items: 4
},
992 : {
items: 4
},
1200 : {
items: 4
}
}
});
};
siteOwlCarousel();
.owl-carousel .owl-wrapper {
display: table!important;
}
.owl-carousel .owl-item {
display: table-cell!important;
float: none!important;
vertical-align: middle!important;
}
.clients-carousel .owl-item .item{
text-align: center!important;
padding: 15px 30px!important;
}
.clients-carousel .owl-item img{
max-width: 180px!important;
max-height: 50px!important;
display: inline-block!important;
}
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.0/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"></script>
<div class="site-section">
<div class="container">
<div class="row justify-content-center text-center mb-5">
<div class="col-md-5">
<h2 class="section-heading">Ils nous ont fait confiance</h2>
</div>
</div>
<div class="row justify-content-center text-center">
<div class="col">
<div class="owl-carousel clients-carousel">
<div class="item"><img src="./img/clients/airbus-group.svg"></div>
<div class="item"><img src="./img/clients/safran-group.png"></div>
<div class="item"><img src="./img/clients/cnrs-fr.svg"></div>
<div class="item"><img src="./img/clients/cea-fr.svg"></div>
<div class="item"><img src="./img/clients/bic.svg"></div>
<div class="item"><img src="./img/clients/edf.svg"></div>
<div class="item"><img src="./img/clients/horiba.svg"></div>
<div class="item"><img src="./img/clients/jenoptec-group.svg"></div>
<div class="item"><img src="./img/clients/otis.svg"></div>
<div class="item"><img src="./img/clients/thales.svg"></div>
</div>
</div>
</div>
</div>
</div>

How to increase the height of the Flickity slider?

I am using Flickity. I have groupCell true. Now the issue is, I am not able to increase the height of the image or slider height.
Also, I have to display the 1 slider in mobile device.
Would you help me out?
$('.slideset').flickity({
// options
cellAlign: 'left',
wrapAround: true,
contain: true,
//groupCells:'%',
groupCells: true,
prevNextButtons: true
});
.carousel-cell {
width: calc( ( 100% - 10px) / 3);
height: 400px;
margin-right: 10px;
border-radius: 5px;
background-color: #f00;
counter-increment: carousel-cell;
}
.slidesetImg img {
width: 100%;
height: 100%;
border: 1px solid #fff;
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.18);
padding: 5px;
object-fit: cover;
}
#media ( min-width: 768px ) {
.carousel-cell {
/* 1 cells in group */
width: calc( ( 100% - 20px ) / 1);
}
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/flickity#2/dist/flickity.min.css">
<section>
<div class="container">
<div class="wrapper">
<div class="main-carousel slideset">
<div class="carousel-cell">
<div class="slidesetImg"><img src="https://images.pexels.com/photos/414612/pexels-photo-414612.jpeg" alt=""></div>
</div>
<div class="carousel-cell">
<div class="slidesetImg"><img src="https://images.pexels.com/photos/414612/pexels-photo-414612.jpeg" alt=""></div>
</div>
<div class="carousel-cell">
<div class="slidesetImg"><img src="https://images.pexels.com/photos/414612/pexels-photo-414612.jpeg" alt=""></div>
</div>
<div class="carousel-cell">
<div class="slidesetImg"><img src="https://images.pexels.com/photos/414612/pexels-photo-414612.jpeg" alt=""></div>
</div>
<div class="carousel-cell">
<div class="slidesetImg"><img src="https://images.pexels.com/photos/414612/pexels-photo-414612.jpeg" alt=""></div>
</div>
<div class="carousel-cell">
<div class="slidesetImg"><img src="https://images.pexels.com/photos/414612/pexels-photo-414612.jpeg" alt=""></div>
</div>
<div class="carousel-cell">
<div class="slidesetImg"><img src="https://images.pexels.com/photos/414612/pexels-photo-414612.jpeg" alt=""></div>
</div>
<div class="carousel-cell">
<div class="slidesetImg"><img src="https://images.pexels.com/photos/414612/pexels-photo-414612.jpeg" alt=""></div>
</div>
</div>
</div>
</div>
</section>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://unpkg.com/flickity#2/dist/flickity.pkgd.min.js"></script>
Flickity has the option setGallerySize which sets the height of the carousel to the height of the tallest cell. It enables by default.
Use setGallerySize: false if you prefer to size the carousel with CSS, rather than using the size of cells.
$('.slideset').flickity({
// options
setGallerySize: false
cellAlign: 'left',
wrapAround: true,
contain: true,
//groupCells:'%',
groupCells: true,
prevNextButtons: true
});
/* carousel height */
.carousel-cell {
height: SOME HEIGHT;
}
.slidesetImg{
height:100% !important;
}
Hope this is what you are looking for.

Is a "complex" matrix style grid powered by a css grid possible?

I am currently trying to achieve the following grid structure in Material-UI with a css grid:
Desired complex layout
I already created a css grid with Material-UI that looks like this:
Current layout
This is the code belonging to it:
import React from "react";
import clsx from "clsx";
import { makeStyles } from "#material-ui/core/styles";
import { Container } from "#material-ui/core";
const useStyles = makeStyles(theme => ({
container: {
marginTop: theme.spacing(8),
display: "grid",
gridTemplateColumns: "repeat(6, 56px)",
gridAutoRows: "56px",
gridGap: theme.spacing(0.5),
},
purple: {
background: "#e502f9",
color: "#ffffff",
height: "100%",
},
orange: {
background: "#f98202",
color: "#ffffff",
height: "100%",
gridColumnStart: "2",
},
lightGrey: {
background: "#d8d8d8",
height: "100%",
},
topLabel: {
gridColumnStart: "3",
gridColumnEnd: "span 4",
},
sideLabel: {
gridRowStart: "3",
gridRowEnd: "span 4",
writingMode: "vertical-rl",
transform: "rotate(180deg)",
},
align: {
alignItems: "center",
display: "flex",
justifyContent: "center",
textAlign: "center",
},
}));
function ExamplePage() {
const classes = useStyles();
return (
<Container component="main" maxWidth="xs">
<div className={classes.container}>
<div />
<div className={clsx(classes.topLabel, classes.align)}>
Text x-axis
</div>
<div className={clsx(classes.sideLabel, classes.align)}>
Text y-axis
</div>
<div />
<div />
<div className={clsx(classes.purple, classes.align)}>1</div>
<div className={clsx(classes.purple, classes.align)}>2</div>
<div className={clsx(classes.purple, classes.align)}>3</div>
<div className={clsx(classes.purple, classes.align)}>4</div>
<div className={clsx(classes.orange, classes.align)}>A</div>
<div className={clsx(classes.lightGrey, classes.align)}>4</div>
<div className={clsx(classes.lightGrey, classes.align)}>4</div>
<div className={clsx(classes.lightGrey, classes.align)}>4</div>
<div className={clsx(classes.lightGrey, classes.align)}>4</div>
<div className={clsx(classes.orange, classes.align)}>B</div>
<div className={clsx(classes.lightGrey, classes.align)}>3</div>
<div className={clsx(classes.lightGrey, classes.align)}>3</div>
<div className={clsx(classes.lightGrey, classes.align)}>3</div>
<div className={clsx(classes.lightGrey, classes.align)}>3</div>
<div className={clsx(classes.orange, classes.align)}>C</div>
<div className={clsx(classes.lightGrey, classes.align)}>2</div>
<div className={clsx(classes.lightGrey, classes.align)}>2</div>
<div className={clsx(classes.lightGrey, classes.align)}>2</div>
<div className={clsx(classes.lightGrey, classes.align)}>2</div>
<div className={clsx(classes.orange, classes.align)}>D</div>
<div className={clsx(classes.lightGrey, classes.align)}>1</div>
<div className={clsx(classes.lightGrey, classes.align)}>1</div>
<div className={clsx(classes.lightGrey, classes.align)}>1</div>
<div className={clsx(classes.lightGrey, classes.align)}>1</div>
</div>
</Container>
);
}
export default ExamplePage;
Does anybody also has an idea on how to programatically set the blue dot somewhere in the grid? I am not sure if this is possible at all in a css grid?
As #Michael_B stated, grid areas must be rectangular. Therefore, it's not possible to create a more complex layout.