Add a scrolling animation to a product slider ( scrollBy js) - slick.js

I made a product slider using Html Css JS and I want the scrollby left and right goes smoth instead of going directly.
Here is my website it works fine on the first slider but the second slider and third that have this issue
Html
<!-- Container for the layout of the full carousel -->
<div class="container2 cover2">
<div class=" scrolling-wrapper scrollmenu-SLIDER2 scroll-images2">
<div class="card2">
<a href=" https://ma.santemagasin.com/produit/hemoconfort/">
<div class="card-img2">
<img src=" https://ma.santemagasin.com/wp-content/uploads/2022/10/hemo-confort-compr.webp">
<h5 class="Product-Disc"> مكمل طبيعي لراحة البواسير
علاج مضمون من المصدر للبواسير الداخلية
حل نهائي للنزيف والالم</h5>
<p class="Product-Prix"> 249د.م.
</p>
<span class="Stars">&bigstar;&bigstar;&bigstar;&bigstar;&bigstar;</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/iron-hair/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/iron-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي خاص بالرجال
sante magasinمن
حل لتساقط الشعر
ملء فراغات اللحية
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">&bigstar;&bigstar;&bigstar;&bigstar;&bigstar;</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/vitex/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/vtx-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي من كف مريم
للنساء ٬ الدورة الشهرية
الحمل ٬ 60 كبسولة نباتية
صنع مغربي٬ 300 ملغرام
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">&bigstar;&bigstar;&bigstar;&bigstar;&bigstar;</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/perfecto/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/prfrcto-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي
لزيادة المناطق الأنثوية
بدون أضرار جانبية
مستخلصات طبيعية
60 كبسولة٬ 300 ملغرام
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">&bigstar;&bigstar;&bigstar;&bigstar;&bigstar;</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/hair-lit/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/hair-lit-300x300.webp">
<h5 class="Product-Disc">
للنساء الشعر والاضافر
تركيبة مطورة ٬ مكمل طبيعي
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">&bigstar;&bigstar;&bigstar;&bigstar;&bigstar;</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/strong-carti/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/strong-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي من
sante magasin
حل للسياتيك والروماتيزم
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">&bigstar;&bigstar;&bigstar;&bigstar;&bigstar;</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/pure-skin/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/pure-skin-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي
من sante magasin
بشرة صافية خالية
من الشوائب والبثور
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">&bigstar;&bigstar;&bigstar;&bigstar;&bigstar;</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/maca/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/maca-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي
من sante magasin
كبسولات جذور الماكا
الطبيعية - العضوية
محفز الطاقة والقوة
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">&bigstar;&bigstar;&bigstar;&bigstar;&bigstar;</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/collagen-complex/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2021/11/collagine-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي
من sante magasin
كولاجين بحري
تركيبة طبيعية
60 كبسولة نباتية
</h5>
<p class="Product-Prix">199 د.م.</p>
<span class="Stars">&bigstar;&bigstar;&bigstar;&bigstar;&bigstar;</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/control-cholesterol/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/bio-cholesto-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي
من sante magasin
كوليسترول متوازن
محاربة الدهون الثلاثية
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">&bigstar;&bigstar;&bigstar;&bigstar;&bigstar;</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/bio-oral-complement-alimentaire/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/bio-oral-300x300.webp">
<h5 class="Product-Disc">
مكمل لصحة الفم
حل طبيعي من المصدر
الرائحة الكريهة٫ اللثة
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">&bigstar;&bigstar;&bigstar;&bigstar;&bigstar;</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/ibs-active-complement-alimentaire/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/ibs-300x300.webp">
<h5 class="Product-Disc">
مستخلصات طبيعية
300 ملغرام - 60 كبسولة
راحة الجهاز الهضمي
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">&bigstar;&bigstar;&bigstar;&bigstar;&bigstar;</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/saw-palmetto/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/palmetto-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي
من sante magasin
للرجال - صحة البروستاتا
مستخلصات طبيعية
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">&bigstar;&bigstar;&bigstar;&bigstar;&bigstar;</span>
</div>
</a>
</div>
<div class="card2">
<a href="https://ma.santemagasin.com/produit/zen-stress/">
<div class="card-img2">
<img src="https://ma.santemagasin.com/wp-content/uploads/2022/09/zen-strees-300x300.webp">
<h5 class="Product-Disc">
مكمل طبيعي مغربي
من sante magasin
نوم مريح - حل للتوتر العصبي
60 كبسولة نباتية
</h5>
<p class="Product-Prix">249 د.م.</p>
<span class="Stars">&bigstar;&bigstar;&bigstar;&bigstar;&bigstar;</span>
</div>
</a>
</div>
</div>
</div>
<div class="cover2">
<button class="left" onclick="leftScroll2()">❮</button>
<button class="right" onclick="rightScroll2()">❯</button>
</div>
CSS
.cover2 {
padding: 0px 30px;
position: relative;
}
.left {
position: absolute;
right: -20px;
top:-170PX;
background-color: transparent !important;
color: #006f07 !important;
font-size: 20px;
font-weight: bold;
border-color: grey;
border-radius: 20%;
}
.right:hover {
background-color: #006F07 !important;
color: white !important;
}
.left:hover {
background-color: #006F07 !important;
color: white !important;
}
.right {
position: absolute;
left: -20px;
top:-170PX;
background-color: transparent !important;
color: #006f07 !important;
font-size: 20px;
font-weight: bold;
border-color: grey;
border-radius: 20%;
margin-left :-10px;
}
.scrollmenu-SLIDER2 {
width: 100%;
height: auto;
display: flex;
flex-wrap: nowrap;
overflow-x: auto;
overflow-y: hidden;
}
.container2 {
display: flex;
overflow-x: auto;
}
.card2 {
padding: 10px;
margin: 10px;
border-radius: 20px;
line-height: 1.2;
background-color: white;
text-align: center;
}
.card2 img{
border-radius: 10px;
}
.Product-Prix{
text-decoration:none;
color : #006f07;
font-size: 20;
font-weight: bold;
margin:5px !important;
}
.Product-Disc{
color: #789FD6;
font-size: 15px;
display: -webkit-box;
max-width: 200px;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
text-align: center;
padding-top: 5px;
margin: auto;
width: 100%;
}
.scroll-images {
width: 100%;
height: auto;
display: flex;
flex-wrap: nowrap;
overflow-x: auto;
overflow-y: hidden;
scroll-behavior: smooth;
-webkit-overflow-scrolling: touch;
}
.Stars{
display: flex;
justify-content: center;
color: orange;
letter-spacing: 0.5px;
font-size: 20px;
}
.card-img2 {
width: 09rem;
}
::-webkit-scrollbar {
display: NONE;
}
#media only screen and (max-width: 800px) {
.card-img2 {
width: 07rem;
}
.card-img3 {
width: 10rem;
}
.left , .right {
display:none;
}
.cover2{
padding: 0px 5px;
position: relative;
}
JS
<script>
function leftScroll2() {
const left = document.querySelector(".scroll-images2");
left.scrollBy(2000, 0) ;
}
function rightScroll2() {
const right = document.querySelector(".scroll-images2");
right.scrollBy(-2000, 0) ;
}
</script>
I tried give different classes for every element than the first slider but the same problem still stop the slider from going smoothly

Related

Bootstrap image card text overlay

Unable to set card footer as expected output
Expected output:
My Code:
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-md-3">
<div class="card">
<img src="https://images.unsplash.com/photo-1523805009345-7448845a9e53?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=752&q=80" class="card-img-top" alt="...">
<div class="card-img-overlay">
<h5 class="card-title"></h5>
</div>
<div class="card-footer text-center">
<h6>
Africa
</h6>
<h4>
Kenya
</h4>
</div>
</div>
</div>
jsfiddle: https://jsfiddle.net/sidh_41/p8sdfy7u/2/
.card-footer:last-child {
border-radius: 0!important;
}
.card-footer {
padding: 0!important;
background-color: unset!important;
border-top: unset!important;
}
.text-center {
color: #fff;
}
.card-img-overlay {
display: flex;
flex-direction: column;
justify-content: flex-end;
height: 100%;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-md-3">
<div class="card">
<img src="https://images.unsplash.com/photo-1523805009345-7448845a9e53?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=752&q=80" class="card-img-top" alt="...">
<div class="card-img-overlay">
<h5 class="card-title"></h5>
<div class="card-footer text-center">
<h6>
Africa
</h6>
<h4>
Kenya
</h4>
</div>
</div>
</div>
</div>
Try this:
.card-footer:last-child {
border-radius: 0!important;
}
.card-footer {
padding: 0!important;
background-color: unset!important;
border-top: unset!important;
}
.text-center {
color: #fff;
}
.card-img-overlay {
display: flex;
flex-direction: column;
justify-content: flex-end;
height: 100%;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-md-3">
<div class="card">
<img src="https://images.unsplash.com/photo-1523805009345-7448845a9e53?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=752&q=80" class="card-img-top" alt="...">
<div class="card-img-overlay">
<h5 class="card-title"></h5>
<div class="card-footer text-center">
<h6 class="m-0 small">
AFRICA
</h6>
<h1>
Kenya
</h1>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="card">
<img class="card-img" src="https://images.unsplash.com/photo-1523805009345-7448845a9e53?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=752&q=80" alt="...">
<div class="card-img-overlay">
<h5 class="card-title"></h5>
<div class="card-footer text-center">
<h6>
Africa
</h6>
<h4>
Kenya
</h4>
</div>
</div>
</div>
</div></div>
I think you need to add another div surrounding the card. This div needs to have the class row
.img-wrapper{
position: relative;
text-align: center;
color: white;
}
.card-footer{
position: absolute;
top: 60%;
left: 50%;
transform: translate(-50%, -50%);
}
h3, h1{
color: #fff
}
<div class="col-md-3">
<div class="card">
<div class="img-wrapper">
<img src="https://images.unsplash.com/photo-1523805009345-7448845a9e53?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=752&q=80" class="card-img-top" alt="...">
<div class="card-img-overlay">
<h5 class="card-title"></h5>
</div>
</div>
</div>
<div class="card-footer text-center">
<h3>
Africa
</h3>
<h1>
Kenya
</h1>
</div>
</div>
</div>

flex scroll with no scroll bar

I am trying to get my main area container (with overflow: auto) to scroll, but with no extra scroll bar. Currently there is an extra scroll bar for the container. I would like to use to main scroll bar to scroll up and down. Im sure ill have to do a slightly different layout to get this to work. I would prefer a flexbox solution, however am open to any method.
https://codepen.io/marti2221/pen/oyxZzx
<section id="container" >
<header id="header" >
<div class="header-top">
<button class="order-btn">Order</button>
<div class="icon-1">
<div class="">icon 1</div>
<div class="">icon 2</div>
</div>
</div>
<div class="header-bottom">
</header>
<article id="content" >
<div class="main-bg">
<div class="menu-box">
<div class="menu-item">
<div class="top-info-wrapper">
<h3>Name</h3>
<h3>$6.50</h3>
</div>
<div class="descr-wrapper">
<p>this is a paragraph about a menu-item. It should be a few sentances long and take up only space in the box</p>
</div>
</div>
<div class="menu-item">
<div class="top-info-wrapper">
<h3>Name</h3>
<h3>$6.50</h3>
</div>
<div class="descr-wrapper">
<p>this is a paragraph about a menu-item. It should be a few sentances long and take up only space in the box</p>
</div>
</div>
<div class="menu-item">
<div class="top-info-wrapper">
<h3>Name</h3>
<h3>$6.50</h3>
</div>
<div class="descr-wrapper">
<p>this is a paragraph about a menu-item. It should be a few sentances long and take up only space in the box</p>
</div>
</div>
<div class="menu-item">
<div class="top-info-wrapper">
<h3>Name</h3>
<h3>$6.50</h3>
</div>
<div class="descr-wrapper">
<p>this is a paragraph about a menu-item. It should be a few sentances long and take up only space in the box</p>
</div>
</div>
<div class="menu-item">
<div class="top-info-wrapper">
<h3>Name</h3>
<h3>$6.50</h3>
</div>
<div class="descr-wrapper">
<p>this is a paragraph about a menu-item. It should be a few sentances long and take up only space in the box</p>
</div>
</div>
<div class="menu-item">
<div class="top-info-wrapper">
<h3>Name</h3>
<h3>$6.50</h3>
</div>
<div class="descr-wrapper">
<p>this is a paragraph about a menu-item. It should be a few sentances long and take up only space in the box</p>
</div>
</div>
</div>
</div>
</article>
</section>
html, body {
height: 100%;
width: 100%;
}
#container {
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
background-color: lightblue;
}
#container header {
background-color: gray;
height: 200px;
display: flex;
flex-direction: column;
}
.header-top {
display: flex;
justify-content: space-between;
}
.order-btn {
align-self: flex-start;
}
#container article {
flex: 1 1 auto;
overflow-y: auto;
min-height: 0px;
}
.main-bg {
display: flex;
justify-content: center;
}
.menu-box {
width: 35%;
border: 1px solid black;
display: flex;
flex-direction: column;
}
.top-info-wrapper {
display: flex;
justify-content: space-between;
}
.icon-1 {
display: flex;
}
.header-bottom {
display: flex;
width: 35%;
}
Removed flex from container div as it was not required. Also moved background-color: lightblue; to article instead of container div. Also added margin: 0; on body tag.
html, body {
height: 100%;
width: 100%;
margin: 0;
}
#container {
height: 100%;
width: 100%;
}
#container header {
background-color: gray;
height: 100px;
position: fixed;
top: 0;
width: 100%;
}
.header-top {
display: flex;
justify-content: space-between;
}
.order-btn {
align-self: flex-start;
}
#container article {
background-color: lightblue;
overflow-y: auto;
min-height: 0px;
margin-top: 100px;
}
.main-bg {
display: flex;
justify-content: center;
}
.menu-box {
width: 35%;
border: 1px solid black;
display: flex;
flex-direction: column;
}
.top-info-wrapper {
display: flex;
justify-content: space-between;
}
.icon-1 {
display: flex;
}
.header-bottom {
display: flex;
width: 35%;
}
<section id="container" >
<header id="header" >
<div class="header-top">
<button class="order-btn">Order</button>
<div class="icon-1">
<div class="">icon 1</div>
<div class="">icon 2</div>
</div>
</div>
<div class="header-bottom">
</header>
<article id="content" >
<div class="main-bg">
<div class="menu-box">
<div class="menu-item">
<div class="top-info-wrapper">
<h3>Name</h3>
<h3>$6.50</h3>
</div>
<div class="descr-wrapper">
<p>this is a paragraph about a menu-item. It should be a few sentances long and take up only space in the box</p>
</div>
</div>
<div class="menu-item">
<div class="top-info-wrapper">
<h3>Name</h3>
<h3>$6.50</h3>
</div>
<div class="descr-wrapper">
<p>this is a paragraph about a menu-item. It should be a few sentances long and take up only space in the box</p>
</div>
</div>
<div class="menu-item">
<div class="top-info-wrapper">
<h3>Name</h3>
<h3>$6.50</h3>
</div>
<div class="descr-wrapper">
<p>this is a paragraph about a menu-item. It should be a few sentances long and take up only space in the box</p>
</div>
</div>
<div class="menu-item">
<div class="top-info-wrapper">
<h3>Name</h3>
<h3>$6.50</h3>
</div>
<div class="descr-wrapper">
<p>this is a paragraph about a menu-item. It should be a few sentances long and take up only space in the box</p>
</div>
</div>
<div class="menu-item">
<div class="top-info-wrapper">
<h3>Name</h3>
<h3>$6.50</h3>
</div>
<div class="descr-wrapper">
<p>this is a paragraph about a menu-item. It should be a few sentances long and take up only space in the box</p>
</div>
</div>
<div class="menu-item">
<div class="top-info-wrapper">
<h3>Name</h3>
<h3>$6.50</h3>
</div>
<div class="descr-wrapper">
<p>this is a paragraph about a menu-item. It should be a few sentances long and take up only space in the box</p>
</div>
</div>
</div>
</div>
</article>
</section>

wrong image sizing with scrollbar under firefox

Here's the problem:
For Chrome, Opera, Safari everthing is fine:
chrome, opera, edge thumb-bar
But firefox has a problem:
firefox thumbbar
The problem is caused by the x-scrollbar which pushes each ".thumbs" and
their children up. The children keep their aspect/ratio thanks to the
combination of height: 100% and object-fit contain, not leaving any gap between them, EXCEPT under firefox. It seems that ".thumbs" doesn't want to wrap correctly around its child image. The height gets adapted, but not the width. I've tried already different combinations of flex: - shorthands, but nothing helped.
.scroll_wrapper {
position: relative;
overflow: hidden;
height: 100px;
}
.thumbs_container {
position: absolute;
display: -webkit-box;
display: -moz-box;
display: -ms-flex;
display: -webkit-flex;
display: flex;
flex-flow: row nowrap;
overflow-x: scroll;
height: 100%;
width: 100%;
}
.thumbs {
display: -webkit-box;
display: -moz-box;
display: -ms-flex;
display: -webkit-flex;
display: flex;
flex-flow: column nowrap;
height: 100%;
}
.thumbs_imgs {
height: 100%;
object-fit: contain;
}
<div class="scroll_wrapper">
<div class="thumbs_container">
<div class="thumbs">
<img src="http://placeimg.com/170/110/any" alt="1" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/115/any" alt="2" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/120/any" alt="3" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/125/any" alt="4" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/130/any" alt="5" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/135/any" alt="6" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/135/any" alt="7" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/140/any" alt="8" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/145/any" alt="9" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/150/any" alt="10" class="thumbs_imgs"/>
</div>
</div>
</div>
I found a solution with a js-workaround:
firefox bug:
js loops through the width of each img and gives each parent ".thumbs" the corresponding width.
x-scrollbar-hide:
-js gets the height of the outer .scroll-wrapper
-js gets the difference of .thumbs_container - .thumbs to get the width of the scrollbar (exactly for each browser, because different)
-js gives the heights of .scroll-wrapper + scrollbar-height to .thumbs_container
window.onload = function() {
scrollbarHide()
}
function scrollbarHide(){
var modalThumbsScrollWrapper = document.getElementsByClassName("scroll_wrapper")[0];
var modalThumbsScrollWrapperHeight = modalThumbsScrollWrapper.offsetHeight;
var modalThumbsContainer = document.getElementsByClassName('thumbs_container')[0];
var modalThumbsContainerHeight = modalThumbsContainer.offsetHeight;
var modalThumbs = document.getElementsByClassName('thumbs')[0];
var modalThumbsHeight = modalThumbs.offsetHeight;
var scrollbarHeight = modalThumbsContainerHeight - modalThumbsHeight;
var newModalThumbsContainerHeight = modalThumbsScrollWrapperHeight + scrollbarHeight;
modalThumbsContainer.style.height = newModalThumbsContainerHeight + "px";
modalThumbsWidthCorrectionFF()
}
function modalThumbsWidthCorrectionFF(){
var modalThumbs = document.getElementsByClassName('thumbs');
var modalThumbsLength = modalThumbs.length;
var modalThumbsImgs = document.getElementsByClassName('thumbs_imgs');
for (var i = 0; i < modalThumbsLength; i++) {
modalThumbs[i].style.width = modalThumbsImgs[i].offsetWidth + "px";
}
}
.scroll_wrapper {
position: relative;
overflow: hidden;
height: 100px;
}
.thumbs_container {
position: absolute;
display: -webkit-box;
display: -moz-box;
display: -ms-flex;
display: -webkit-flex;
display: flex;
flex-flow: row nowrap;
overflow-x: scroll;
height: 100%;
width: 100%;
}
.thumbs {
display: -webkit-box;
display: -moz-box;
display: -ms-flex;
display: -webkit-flex;
display: flex;
flex-flow: column nowrap;
height: 100%;
}
.thumbs_imgs {
height: 100%;
object-fit: contain;
}
<div class="scroll_wrapper">
<div class="thumbs_container">
<div class="thumbs">
<img src="http://placeimg.com/170/110/any" alt="1" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/115/any" alt="2" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/120/any" alt="3" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/125/any" alt="4" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/130/any" alt="5" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/135/any" alt="6" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/135/any" alt="7" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/140/any" alt="8" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/145/any" alt="9" class="thumbs_imgs"/>
</div>
<div class="thumbs">
<img src="http://placeimg.com/170/150/any" alt="10" class="thumbs_imgs"/>
</div>
</div>
</div>

Issue Firefox - Carousel Bootstrap with background-attachment: fixed

I have an Issue with the Bootstrap Carousel.
I want to have the fixed effect but in Firefox it's giving jumps.
HTML
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<div class="carousel-item-content" style="background:url('http://www.kia.ca/content/2018-soul/gallery/gallery-img-3.jpg')">
</div>
</div>
<div class="carousel-item">
<div class="carousel-item-content" style="background:url('http://carimages.silovendes.com/imgAutos/11/1056445-0.jpg')">
</div>
</div>
<div class="carousel-item">
<div class="carousel-item-content" style="background:url('https://kia.com.gt/images/modelos/rio/img/exterior-old//thumb/5.jpg')">
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
CSS
.carousel-item {
width: 100%;
height: 100vh;
}
.carousel-item .carousel-item-content {
width: 100%;
height: 100%;
-webkit-background-size: cover !important;
-moz-background-size: cover !important;
-o-background-size: cover !important;
background-size: cover !important;
background-position: center center !important;
background-repeat: no-repeat !important;
overflow: hidden !important;
background-attachment: fixed !important;
}
You can try it hier:
https://codepen.io/TamZam/pen/ZvQvox
Any ideas why it happens?
Thanks!

Styling individual tabpanel in Kendo Tabstrip

I'm using the Kendo-UI Tabstrip, and would like to add a class to one specific tabpanel. Is this possible? Using .SpriteCssClasses within the items.Add() section only seems to add the class to the tab itself, and not the actual panel.
Any help is greatly appreciated.
You can try to get the specific panel using the ID because kendo will add a div with specific ID depending on the name of the tab strip and the tab number (order), for example:
#(Html.Kendo().TabStrip()
.Name("Main")
.Items(Main =>
{
Main.Add()
.Text("test1 title").Content(#<text>
test1
</text>);
Main.Add()
.Text("test2 title")
.Content(#<text>
test2
</text>);
})
)
This will generate the following HTML:
<div class="k-tabstrip-wrapper" style="">
<div id="Main" class="k-widget k-tabstrip k-header" data-role="tabstrip" tabindex="0" role="tablist" aria-activedescendant="Main_ts_active">
<ul class="k-reset k-tabstrip-items">
<li class="k-item k-state-default k-first k-tab-on-top k-state-active" role="tab" aria-controls="Main-1" style="" aria-selected="true">
<span class="k-loading k-complete"></span>
test1 title
</li>
<li class="k-item k-state-default k-last" role="tab" aria-controls="Main-2" style="">
<span class="k-loading k-complete"></span>
test2 title
</li>
</ul>
<div id="Main-1" class="k-content k-state-active" role="tabpanel" aria-expanded="true" style="height: auto; overflow: hidden; opacity: 1; display: block;">
<div style="display: none; position: absolute; opacity: 0.8; background-color: rgb(255, 255, 255); z-index: 1001; width: 33.4px; height: 20px;" class="tata-ajax-loader">
<div style="background-position: center;background-repeat: no-repeat;height:100%;width:100%;background-color: transparent;" class="tata-ajax-loader-img"></div>
</div>
test1
</div>
<div id="Main-2" class="k-content" role="tabpanel" aria-expanded="false" style="height: auto; overflow: hidden; opacity: 0; display: none;" aria-hidden="true">
<div style="display: none; position: absolute; opacity: 0.8; background-color: rgb(255, 255, 255); z-index: 1001; width: 33.4px; height: 20px;" class="tata-ajax-loader">
<div style="background-position: center;background-repeat: no-repeat;height:100%;width:100%;background-color: transparent;" class="tata-ajax-loader-img"></div>
</div>
test2
</div>
</div>
</div>
Note the divs with IDs "Main-1" and "Main-2" are the IDs of the actual panels which is what you want from what I understand so you can add CSS on the IDs:
#Main-1 {
background-color: #E3F7A8;
}

Resources