Hi I used this Codepen for a client site (Squarespace). I tinkered a lot via CSS only.>
- Please check a specific client page; password is mmmm1234
- Scroll down and check "Discover Online Experiences" section where I implemented the slider
- For example, if viewed in a smaller screen size, like 1280px width, page breaks
- It breaks most especially in iPad versions
- Usually, if we put 4 or 5 cards only, it won't break the page
- But eventually we should be able to put more
- A contributor / developer from Squarespace couldn't help me about this and mentioend that maybe the owlcarousel itself had the problem
- Can anyone help me?
Below is the css and js of the one I used for client's
<link href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.2.1/assets/owl.carousel.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.2.1/assets/owl.theme.default.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.40/css/uikit.min.css" rel="stylesheet">
<style>
.uk-margin {
padding: 0 !important;
margin: 0 !important;
}
.uk-section {
background-color: none !important;
padding-top: 0 !important;
padding-bottom: 0 !important;
}
.owl-carousel {
position: relative;
margin-top: 30px;
}
.owl-nav {
position: absolute;
top: -45px;
right: 10px;
}
.uk-card-primary {
border: none;
border-radius: 0 0 13px 13px;
background: none !important;
background-color: none !important;
color: none !important;
margin: 0 5px 5px 5px !important;
box-shadow: 0 3px 5px 0 rgb(0 0 0 / 50%) !important;
min-height: 114px !important;
}
.uk-card > :last-child {
margin-top:0;
margin-bottom: 10px;
min-height: 114px !important;
}
.owl-dots {
margin-top: 0 !important;
}
.uk-card-title {
margin: 0 0 15px 0 !important;
color: black !important;
font-size: 15px;
line-height: 120%;
}
.crd-rate {
margin: 0 !important;
color: black !important;
font-size: 13px;
line-height: 120%;
}
#crd-rate {
color: black !important;
font-weight: 700 !important;
}
#dsc {
margin: 0 0 15px 0 !important;
color: #808080;
font-size: .8em;
line-height: 120%;
}
.uk-card-primary.uk-card-hover:hover {
background-color: none !important;
box-shadow: none !important;
border: 1px solid #cecece;
}
.owl-stage {
padding: 15px !important;
}
.uk-card-body {
padding: 8px 10px 10px 10px !important;
}
.uk-link, a {
color: inherit !important;
}
/*
----
Card Image
----
*/
.crd-img {
padding: 5px 5px 0 5px;
}
#crd-img {
border-radius: 13px 13px 0 0;
}
/*
----
Rate, Star, Reviews
----
*/
.d-flex1, .align-items-end1, .justify-content-between1 {
text-align: left;
word-wrap: break-word;
box-sizing: border-box;
margin: 0 !important;
}
.d-flex1 {
display: flex !important;
}
.align-items-end1 {
align-items: flex-start !important;
}
.justify-content-between1 {
justify-content: flex-start !important;
}
#crd-rating, #crd-star, #crd-review {
margin-right: 5px !important;
font-size: 13px !important;
color: black !important;
}
/*#crd-rating, #crd-review {
margin-top: 2px !important;
}*/
#crd-rating {
color: black !important;
font-weight: 700 !important;
}
#crd-star {
max-width: 20px !important;
margin-top: -2px !important;
}
#crd-review {
font-weight: 100 !important;
}
/*
----
Owl Carousel
----
*/
.owl-theme .owl-nav {
margin-top: 10px;
text-align: center;
-webkit-tap-highlight-color: transparent; }
.owl-theme .owl-nav [class*='owl-'] {
color: black;
font-size: 14px;
margin: 5px;
padding: 4px 7px;
background: none;
display: inline-block;
cursor: pointer;
border-radius: 3px; }
.owl-theme .owl-nav [class*='owl-']:hover {
background: none;
color: #808080;
text-decoration: none; }
.owl-theme .owl-nav .disabled {
opacity: 0.5;
cursor: default; }
.owl-theme .owl-nav.disabled + .owl-dots {
margin-top: 10px; }
.owl-theme .owl-dots {
text-align: center;
-webkit-tap-highlight-color: transparent; }
.owl-theme .owl-dots .owl-dot {
display: inline-block;
zoom: 1;
*display: inline; }
.owl-theme .owl-dots .owl-dot span {
width: 10px;
height: 10px;
margin: 5px 7px;
background: #a7a7a7;
display: block;
-webkit-backface-visibility: visible;
transition: opacity 200ms ease;
border-radius: 30px; }
.owl-theme .owl-dots .owl-dot.active span, .owl-theme .owl-dots .owl-dot:hover span {
background: #cecece; }
.owl-item.active {
margin: 0 !important;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.40/js/uikit.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-beta.40/js/uikit-icons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.2.1/owl.carousel.js"></script>
<script>
$('.owl-carousel').owlCarousel({
loop:false,
stagePadding: 15,
margin:10,
nav:true,
navText : ['<span class="uk-margin-small-right uk-icon" uk-icon="icon: chevron-left"></span>','<span class="uk-margin-small-left uk-icon" uk-icon="icon: chevron-right"></span>'],
responsive:{
0:{
items:2
},
640:{
items:3
},
960:{
items:4
},
1200:{
items:5
}
}
})
</script>