SwiperJS Thumbs bug - swiper.js

Created a swipe with thumbs. When I click on thumbs, it scrolls to the right with incomprehensible logic. I cannot understand what this may be connected with, I am trying to solve this problem for the second day, nothing comes out. Is it possible to somehow disable this option so that you can remove this scroll when clicked?
const productThumbs = new Swiper(".swiper-thumbs", {
spaceBetween: 30,
loop: true,
slidesPerView: 6,
loopedSlides: 7,
});
const productCarousel = new Swiper(".swiper-content", {
effect: 'fade',
fadeEffect: {
crossFade: true
},
touchRatio: 0,
thumbs: {
swiper: productThumbs,
}
});
.swiper-slide{
background: gray;
}
.swiper-thumbs .swiper-slide{
height: 300px;
}
.swiper-content{
margin-top: 30px;
}
.swiper-thumbs .swiper-slide{
display: flex;
flex-direction: column;
}
.swiper-content .swiper-slide{
height: 250px;
background: black;
color: white;
font-size: 72px;
}
<link href="https://unpkg.com/swiper/swiper-bundle.min.css" rel="stylesheet"/>
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
<div class="swiper-container swiper-thumbs">
<div class="swiper-wrapper">
<div class="swiper-slide">
<span class="slider-title">01</span>
<img src='https://i.ibb.co/Tq5Hvp8/1.png'>
<span class="slider-desc">Windows Server</span>
</div>
<div class="swiper-slide">
<span class="slider-title">02</span>
<img src='https://i.ibb.co/Tq5Hvp8/1.png'>
<span class="slider-desc">Windows Server</span>
</div>
<div class="swiper-slide">
<span class="slider-title">03</span>
<img src='https://i.ibb.co/Tq5Hvp8/1.png'>
<span class="slider-desc">Windows Server</span>
</div>
<div class="swiper-slide">
<span class="slider-title">04</span>
<img src='https://i.ibb.co/Tq5Hvp8/1.png'>
<span class="slider-desc">Windows Server</span>
</div>
<div class="swiper-slide">
<span class="slider-title">05</span>
<img src='https://i.ibb.co/Tq5Hvp8/1.png'>
<span class="slider-desc">Windows Server</span>
</div>
<div class="swiper-slide">
<span class="slider-title">06</span>
<img src='https://i.ibb.co/Tq5Hvp8/1.png'>
<span class="slider-desc">Windows Server</span>
</div>
</div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
<div class="swiper-container swiper-content">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
<div class="swiper-slide">Slide 1</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
<div class="swiper-slide">Slide 4</div>
<div class="swiper-slide">Slide 5</div>
<div class="swiper-slide">Slide 6</div>
</div>
</div>
I tried to do this, but I just simply do not understand why this is happening

In the "thumbs" slider, you need to change the value "loop" to "false" or remove the key "loop" from "thumbs" slider.

Related

Show Swiper slider out of container

The slider slides out of the container.
I do not want to use overflow: hidden for the container.
Here my code:
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">Slide a</div>
<div class="swiper-slide">Slide b</div>
<div class="swiper-slide">Slide c</div>
<div class="swiper-slide">Slide d</div>
<div class="swiper-slide">Slide e</div>
<div class="swiper-slide">Slide f</div>
<div class="swiper-slide">Slide g</div>
<div class="swiper-slide">Slide h</div>
<div class="swiper-slide">Slide i</div>
<div class="swiper-slide">Slide j</div>
</div>
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
</div>
var swiper = new Swiper('.swiper-container', {
slidesPerView: 5,
spaceBetween: 9,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
});
Look this:
image
You can try this solution:
const swiper = new Swiper(".swiper-container", {
// Optional parameters
loop: false,
slidesPerView: "auto",
spaceBetween: 30,
breakpoints: {
// when window width is >= 320px
300: {
slidesPerView: 1.5
},
// when window width is >= 480px
600: {
slidesPerView: 2.5
},
// when window width is >= 640px
900: {
slidesPerView: 3.5
},
1200: {
slidesPerView: 4.5
}
}
});
.swiper-overflow-container {
overflow-x: hidden;
}
.container {
overflow: visible;
outline: 2px solid red;
}
.swiper-container {
overflow: visible;
}
.item {
outline: 1px solid cyan;
}
.image {
width: 100%;
padding-bottom: 100%;
background: #808080;
}
<link href="https://unpkg.com/swiper/swiper-bundle.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
<div class="swiper-overflow-container">
<div class="container py-5">
<div class="swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
<div class="swiper-slide">
<div class="item">
<div class="image"></div>
<p>First</p>
</div>
</div>
<div class="swiper-slide">
<div class="item">
<div class="image"></div>
<p>Second</p>
</div>
</div>
<div class="swiper-slide">
<div class="item">
<div class="image"></div>
<p>Thrid</p>
</div>
</div>
<div class="swiper-slide">
<div class="item">
<div class="image"></div>
<p>Four</p>
</div>
</div>
<div class="swiper-slide">
<div class="item">
<div class="image"></div>
<p>Five</p>
</div>
</div>
<div class="swiper-slide">
<div class="item">
<div class="image"></div>
<p>Six</p>
</div>
</div>
</div>
</div>
</div>
</div>
HTML:
<div class="swiper-overflow-container">
<div class="container">
<!-- swiper html here -->
</div>
</div>
CSS:
.swiper-overflow-container {
overflow-x: hidden; /* prevent horizontal scroll */
}
.swiper-overflow-container .container {
overflow: visible; /* if your container has overflow by default */
}
.swiper-overflow-container .swiper-container {
overflow: visible; /* remove swiper container overflow */
}
Limitations: not working properly with loop: true

Make the space between the columns small inside the card

I have this shape and want to approximate the distance between each column, meaning I want to approximate the distance between each blue piece, how can I do that_?
Card.vue:
<template>
<div>
<div class="card d-inline-flex" style="width: 40rem; height:7rem; ">
<div class="row background">
<div class="col">
<div class="p-5 bg-info rounded-left ">Flex item 1</div>
</div>
<div class="col">
<div class="p-5 bg-info rounded-0 ">Flex item 1</div>
</div>
<div class="col">
<div class="p-5 bg-info rounded-right">Flex item 1</div>
</div>
</div>
</div>
</div>
</template>
<script></script>
<style>
.background {
background-color: #dcdcdc;
}
.d {
margin-left: 4px;
}
</style>
The space is there because bootstrap has a padding-left and padding-right of 15px for the class col pre-defined. So to get the space that you want, just add a custom class to your div and mess around with padding-left and padding-right. But don't forget to use "!important" as you want to override the style defined by Bootstrap. Here is an Example :-
<template>
<div>
<div class="card d-inline-flex" style="width: 40rem; height:7rem; ">
<div class="row background">
<div class="col a">
<div class="p-5 bg-info rounded-left ">Flex item 1</div>
</div>
<div class="col a">
<div class="p-5 bg-info rounded-0 ">Flex item 1</div>
</div>
<div class="col a">
<div class="p-5 bg-info rounded-right">Flex item 1</div>
</div>
</div>
</div>
</div>
</template>
<script></script>
<style>
.background {
background-color: #dcdcdc;
}
.d {
margin-left: 4px;
}
.a {
padding-left:0 !important!;
padding-right:0 !important!;
}
</style>
Here i used a custom class called a, just mess around with padding-left to get the space you need.

PDF file created using snappy is not displayed well

I am creating a pdf file using snappy1.4,
I want create 2 pages ,each of them divided in 2 parts (vertically),
I have created them: when they are empty its ok but when I fill for example a part1 with some data the part2 is shifted down.
How can I fix the 4 parts in a way that they still fixed (in hight) if they are empty or some of them filled
example1 with empty data (ok):
shifted pdf:
My code:
return new Response(
$this->get('knp_snappy.pdf')->getOutputFromHtml($html,array(
'orientation'=>'Landscape',
'default-header'=>null,
// 'custom-header' =>false,
//'page-size' =>'A4',
// 'no-custom-header-propagation'=>false,
'encoding' => 'utf-8',
'images' => true,
'enable-javascript' => true,
'margin-right' => 1,
'margin-left' =>2,
'margin-top' =>0,
'margin-bottom' =>0,
'javascript-delay' => 5000
)),
200,
array(
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="file1.pdf"'
)
);
my twig:
<body>
<div style=" padding-left:3em;margin-top: 10px;display:inline-block;height: 0.3in ">
<div style="width:35px;display:inline-block;vertical-align: middle;height: 0.3in"><img style="width:35px " src="{{ absolute_url(asset('images/visa.png' ))}} " id="imgtun"></div>
</div>
<div style=" padding-left:20em;margin-top: 10px;display:inline-block;height: 0.3in">
<div style="width:35px;display:inline-block;vertical-align: middle;height: 0.3in"><img style="width:35px " src="{{ absolute_url(asset('images/visa.png' ))}} " id="imgcenter"></div>
<div style=" display:inline-block;font-size: 20px; font-weight: bold;vertical-align: middle; text-align: center;height: 0.3in">
<span style="text-align: center">My file with 4 parts </span></div>
</div>
<div id="Page1" style="width: 100%; height: 7.8in">
<div id="Partie_presentation" style="display:inline-block;height: 7.8in; width: 30%">
<div style="height:0.3in" id="header_presentation">
<p style="height:25px;background-color:darkseagreen;font-weight: bold;font-size: 20px">
Part1</p>
</div>
<div style="height: 7.5in" id="partie_presentation" >
<div style="height:1.8in">
<p>
<span class="detailtitre" style="font-weight: bold">Adress :</span>
<span class="detailcont">My adress</span>
</p>
<p>
<span class="detailtitre" style="font-weight: bold">Tél :</span>
<span class="detailcont">3389652368</span>
</p>
<p>
<span class="detailtitre" style="font-weight: bold">E-mail :</span>
<span class="detailcont">email#gmail.com</span>
</p>
<p>
<span class="detailtitre" style="font-weight: bold">Website :</span>
<span class="detailcont">my webste</span>
</p>
</div>
</div>
</div>
<div id="Part2"style="height: 7.8in; display:inline-block;width: 69%">
<div style="height:0.3in" id="entete_res">
<p style="height:25px;background-color:darkseagreen;font-weight: bold;font-size: 20px">
Part2</p>
</div>
<div style="height: 7.5in" id="partie_res" >
<div id="partie_budget" style="height: 3.8in">
</div>
<div id="partie_pers" style="height: 4in">
</div>
</div>
</div>
</div>{#end page1#}
<div id="Page2" style="width: 100%; height: 8.1in">
{# partie_ac #}
<div id="Part3" style=" margin-top:2px;display:inline-block;height: 8.1in; width: 49%">
<div style="height: 0.3in">
<p style="height:19px;background-color:darkseagreen;font-weight: bold;font-size: 19px">
Part3</p>
</div>
<div style="height: 7.8in" id="partie_ac" >
</div>
</div>
{# partie_per #}
<div id="Part4" style="display:inline-block;height: 8.1in; width: 50%">
<div style="height: 0.3in">
<p style="height:19px;background-color:darkseagreen;font-weight: bold;font-size: 19px">
Part4</p>
</div>
<div style="height: 7.8in" id="partie_per" >
</div>
</div>
</div>
</body>
This is a CSS problem. Here's one way to fix it:
#Partie_presentation {
float: left;
}
#Part2 {
float: right; /* or left */
}
See JSFiddle
If it's possible in your case (I don't know how Snappy works), move the CSS styles to a <style> tag or to a separate CSS file. Now you are using inline styles so the HTML is very messy.

Stacked progress bars with labels and min-width

I've got my stacked progress bars looking nice, with percentage labels on each, but I'm not sure how to solve when a percentage causes the bar to be too small for the label.
Setting a min-width works for non-stacked progress bars, but breaks stacked ones.
How can I fix this without hacking up bootstrap too much?
Example fiddle: http://jsfiddle.net/nimh/kx7hvxyz/
<div class="container-fluid">
<div class="row-fluid">
<div class="panel panel-default max-width">
<div class="panel-body">
<div class="progress">
<div class="progress-bar progress-bar-success" style="width: 89.74%">
<div class="text-left">+89.74%</div>
</div>
<div class="progress-bar progress-bar-danger" style="width: 10.26%">
<div class="text-right">-10.26%</div>
</div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-success" style="width: 10.26%">
<div class="text-left">+10.26%</div>
</div>
<div class="progress-bar progress-bar-danger" style="width: 89.74%">
<div class="text-right">-89.74%</div>
</div>
</div>
</div>
</div>
</div>
Had a night to think about it and realized i can add a max-width percentage, as well as a min-width percentage, to keep stacked progress bars at least wide enough to show a label on both.
.progress-bar {
min-width: 15%;
max-width: 85%;
}
http://jsfiddle.net/nimh/kx7hvxyz/8/
It's not perfect (may look funny with a 99% and 1%), but will work for showing a label at all times for our needs.
How about playing with the line-height and font-size?
[1]: http://www.bootply.com/Tq7YbaeOX5
/* CSS used here will be applied after bootstrap.css */
.max-width {
max-width: 25em;
}
/* .progress-bar {
min-width: 4em;
} */
.progress-bar {
padding: 4px;
line-height: 12px;
}
.text-Left {
font-size: 12px;
float: left;
}
.text-left, .text-right {
font-size: 7px;
padding-right:5px;
}
.text_Right {
float: right;
}
<div class="container-fluid">
<div class="row-fluid">
<div class="panel panel-default max-width">
<div class="panel-body">
<div class="progress">
<div class="progress-bar progress-bar-success" style="width: 89.74%">
<div class="text-Left">+89.74%</div>
</div>
<div class="progress-bar progress-bar-danger" style="width: 10.26%">
<div class="text-right">-10.26%</div>
</div>
</div>
<div class="progress">
<div class="progress-bar progress-bar-success" style="width: 10.26%">
<div class="text-left">+10.26%</div>
</div>
<div class="progress-bar progress-bar-danger" style="width: 89.74%">
<div class="text_Right">-89.74%</div>
</div>
</div>
</div>
</div>
</div>
</div>

how to fix this grid system issue in bootstrap

I have an in img in boostrap and i want it to show in right and to show 4 objects in the left in two rows each one has two objects which is 4 columns from the grid
My HTML
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12 img-container">
<div class="product first wow zoomInDown "
data-wow-delay="0.3s" data-wow-duration="2s">
<img src="images/hiro1.jpg" width="600" alt="" class="img-responsive" >
<h6 class="text-center">it is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout</h6>
<p>Energy</p>
</div> <!-- end of product-->
</div> <!-- end of bootstrap columns-->
<div class="col-md-4 col-sm-6 col-xs-12 img-container">
<div class="product second wow zoomInDown "
data-wow-delay="0.3s" data-wow-duration="2s">
<img src="images/hiro2.jpg" width="600" alt="" class="img-responsive">
<h6 class="text-center">it is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout</h6>
<p>Phyto</p>
</div> <!-- end of product-->
</div> <!-- end of bootstrap columns-->
<div class="banner">
<img src="http://placehold.it/300x450">
</div>
<div class="clearfix"></div>
<div class="col-md-4 col-sm-6 col-xs-12 img-container">
<div class="product second wow zoomInDown "
data-wow-delay="0.3s" data-wow-duration="2s">
<img src="images/hiro2.jpg" width="600" alt="" class="img-responsive">
<h6 class="text-center">it is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout</h6>
<p>Phyto</p>
</div> <!-- end of product-->
</div> <!-- end of bootstrap columns-->
<div class="col-md-4 col-sm-6 col-xs-12 img-container">
<div class="product second wow zoomInDown "
data-wow-delay="0.3s" data-wow-duration="2s">
<img src="images/hiro2.jpg" width="600" alt="" class="img-responsive">
<h6 class="text-center">it is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout</h6>
<p>Phyto</p>
</div> <!-- end of product-->
</div> <!-- end of bootstrap columns-->
</div> <!-- end of row-->
MY CSS
.product{ overflow: hidden; margin-bottom: 40px; position: relative; cursor: pointer; float: left;}
.product p {position: absolute; top: 10%; left:200%; color: white;
z-index: 2000; font-size: 20px; opacity:0; transition:all 0.5s;}
.product h6 {position: absolute; top: 40%; left:-200%; color: white;
z-index: 3000; font-size: 20px; opacity:0; transition:all 0.5s ; line-height: 20px;
transition-timing-function: cubic-bezier(0.000, 0.000, 0.580, 1.000); }
and this is the result that shows up
http://i.imgur.com/2PhECdx.jpg
I have modified your code to make two columns and the first column is containing two rows with two columns.
<div class="row">
<div class="col-md-8 col-sm-6 col-xs-12">
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-12 img-container">
</div>
<div class="col-md-6 col-sm-6 col-xs-12 img-container">
</div>
</div>
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-12 img-container">
</div>
<div class="col-md-6 col-sm-6 col-xs-12 img-container">
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12 img-container">
</div>
</div>
Check this:
http://jsfiddle.net/h68hzfnc/