Display element outside of "overflow: hidden" in Swiper slider - html

THE PROBLEM
I have a swiper slider: http://codepen.io/kerowan/pen/xqYrwJ (recreate problem for example by giving .product-info-wrapper a fixed height of around 100px)
In the slides, there is an image and an infobox, which initially looks like this:
When I click on "Kurzinfo", the box needs to expand and finally look like this (the .swiper-container ends just after the NEW badge, so it has to flow over the swiper-container):
The problem is, that .swiper-container has an overflow: hidden; attribute, to hide the slides that continue to the right side.
WHAT HAVE I TRIED?
1) I have tried changing overflow: hidden; on the .swiper-container to overflow-x: hidden; in an attempt to just hide the slides which flow to the right, but show stuff that overflows downwards. This results in .swiper-container just adding a scrollbar, which lets you scroll down to see the content that should overflow.
2) I have tried changing position: absolute; on .product-info-wrapper (which wraps the box and the badge) to position: fixed;, because I read that the overflow attribute is ignored by position: fixed;. This doesn't seem to solve the problem, however.
I have not tried anything else yet, simply because I don't know any other solution approach.
SNIPPET
I pasted the snippet here, but it won't work, because I used SCSS and unfortunately lack the time to rewrite it to pure CSS. Can be copied to codepen, though, if the link above should die.
$(document).ready(function() {
var productsInFocus = new Swiper ('.products-in-focus', {
nextButton: '.product-focus-next',
prevButton: '.product-focus-prev',
slidesPerView: 4,
loop: false,
spaceBetween: 20
});
});
.content-wrapper {
max-width: 1100px;
margin: 0 auto;
}
.product-wrapper {
position: relative;
margin-bottom: 1rem * 5;
margin-top: 1rem * 5;
.swiper-slide {
display: flex;
justify-content: center;
align-items: flex-start;
position: relative;
min-height: 230px;
.product-badge-wrapper {
position: absolute;
bottom: 0;
right: 0;
.product-badge {
position: relative;
width: 100px;
overflow: hidden;
&.red {
&:before,
&:after {
border-color: #CF043C;
background-color: transparent;
}
&:after {
background-color: transparent;
border-left-color: transparent;
}
.product-badge-content {
&:before {
border-color: darken(#CF043C, 10%);
border-left-color: transparent;
border-right-color: transparent;
}
}
}
&.dark-gray {
&:before,
&:after {
border-color: lighten(#000, 37.4%);
background-color: transparent;
}
&:after {
background-color: transparent;
border-left-color: transparent;
}
.product-badge-content {
&:before {
border-color: lighten(#000, 13.5%);
border-left-color: transparent;
border-right-color: transparent;
}
}
}
&:before,
&:after {
content: "";
position: absolute;
left: 0;
background-color: transparent;
border-color: lighten(#000, 73%);
}
&:before {
top: 20px;
right: 0;
bottom: 0;
}
&:after {
bottom: auto;
left: -1px;
top: -10px;
border-style: solid;
border-width: 0 0 75px 75px;
background-color: transparent;
border-left-color: transparent;
width: 100px;
}
.product-badge-content {
height: 43px;
padding-right: 5px;
padding-left: 22px;
display: flex;
justify-content: flex-end;
align-items: center;
text-align: right;
text-transform: uppercase;
font-weight: 700;
position: relative;
z-index: 10;
color: #fff;
&.text-small {
font-size: .7rem;
font-weight: 400 !important;
}
&:before {
content: "";
position: absolute;
left: 11px;
bottom: 0;
display: block;
border-style: solid;
border-color: lighten(#000, 37.4%);
border-left-color: transparent;
border-right-color: transparent;
border-width: 10px 10px 0 10px;
}
}
}
}
.product-info-wrapper {
position: absolute;
bottom: 0;
max-width: 100%;
width: 100%;
padding-bottom: 10px;
.product-info {
position: relative;
padding: 1rem * .5;
padding-right: 1rem * 2;
overflow: hidden;
&-link {
display: block;
a {
color: lighten(#000, 37.4%);
transition: color 400ms ease-in-out;
&:hover {
color: #CF043C;
text-decoration: none;
}
}
}
&-price {
color: #CF043C;
&-del {
color: lighten(#000, 37.4%);
text-decoration: line-through;
font-size: .9rem;
}
}
&:before,
&:after {
position: absolute;
content: "";
left: 0;
z-index: -1;
background-color: lighten(#000, 93.5%);
border-color: lighten(#000, 93.5%);
}
&:before {
top: 0;
right: 0;
bottom: 35px;
}
&:after {
top: auto;
right: -5px;
bottom: 0;
border-style: solid;
border-width: 35px 35px 0 0;
background-color: transparent;
border-right-color: transparent;
}
}
}
}
.product-focus-prev,
.product-focus-next {
position: absolute;
color: lighten(#000, 37.4%);
background-image: none;
display: flex;
justify-content: center;
align-items: center;
font-size: 2rem;
top: 50%;
transform: translateY(-50%);
cursor: pointer;
}
.product-focus-prev {
left: -1rem * 10;
}
.product-focus-next {
right: -1rem * 10;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://use.fontawesome.com/b13050afbe.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.1/js/swiper.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.1/js/swiper.jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.1/css/swiper.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="content-wrapper narrow products-in-focus">
<div class="product-wrapper">
<div class="swiper-container products-in-focus">
<div class="swiper-wrapper">
<div class="swiper-slide">
<img src="http://www.placehold.it/80x130">
<div class="product-info-wrapper">
<div class="product-info">
<div class="row no-gutters">
<div class="col-7">
<strong class="text-uppercase">Amino Force</strong>
<span class="product-info-link">Kurzinfo</span>
</div>
<div class="col-5 text-right">
<div class="product-info-price">CHF 34.00</div>
</div>
</div>
</div>
<div class="product-badge-wrapper">
<div class="product-badge dark-gray">
<div class="product-badge-content text-center">
%
</div>
</div>
</div>
</div>
</div>
<div class="swiper-slide">
<img src="http://www.placehold.it/80x130">
<div class="product-info-wrapper">
<div class="product-info">
<div class="row no-gutters">
<div class="col-8">
<strong class="text-uppercase">Basic Minerals</strong>
<span class="product-info-link">Kurzinfo</span>
</div>
<div class="col-4 text-right">
<span class="product-info-price">CHF 34.00</span>
</div>
</div>
</div>
<div class="product-badge-wrapper">
<div class="product-badge red">
<div class="product-badge-content">
new
</div>
</div>
</div>
</div>
</div>
<div class="swiper-slide">
<img src="http://www.placehold.it/80x130">
<div class="product-info-wrapper">
<div class="product-info">
<div class="row no-gutters">
<div class="col-8">
<strong class="text-uppercase">Amino Force</strong>
<span class="product-info-link">Kurzinfo</span>
</div>
<div class="col-4 text-right">
<span class="product-info-price">CHF 34.00</span>
</div>
</div>
</div>
</div>
</div>
<div class="swiper-slide">
<img src="http://www.placehold.it/80x130">
<div class="product-info-wrapper">
<div class="product-info">
<div class="row no-gutters">
<div class="col-8">
<strong class="text-uppercase">Whey Isolat CFM</strong>
<span class="product-info-link">Kurzinfo</span>
</div>
<div class="col-4 text-right">
<span class="product-info-price">CHF 34.00</span>
</div>
</div>
</div>
<div class="product-badge-wrapper">
<div class="product-badge">
<div class="product-badge-content text-small">
nicht<br>auf lager
</div>
</div>
</div>
</div>
</div>
<div class="swiper-slide">
<img src="http://www.placehold.it/80x130">
<div class="product-info-wrapper">
<div class="product-info">
<div class="row no-gutters">
<div class="col-8">
<strong class="text-uppercase">Amino Force</strong>
<span class="product-info-link">Kurzinfo</span>
</div>
<div class="col-4 text-right">
<span class="product-info-price">CHF 34.00</span>
</div>
</div>
</div>
<div class="product-badge-wrapper">
<div class="product-badge red">
<div class="product-badge-content">
new
</div>
</div>
</div>
</div>
</div>
<div class="swiper-slide">
<img src="http://www.placehold.it/80x130">
<div class="product-info-wrapper">
<div class="product-info">
<div class="row no-gutters">
<div class="col-8">
<strong class="text-uppercase">Basic Minerals</strong>
<span class="product-info-link">Kurzinfo</span>
</div>
<div class="col-4 text-right">
<span class="product-info-price">CHF 34.00</span>
</div>
</div>
</div>
</div>
</div>
<div class="swiper-slide">
<img src="http://www.placehold.it/80x130">
<div class="product-info-wrapper">
<div class="product-info">
<div class="row no-gutters">
<div class="col-8">
<strong class="text-uppercase">Amino Force</strong>
<span class="product-info-link">Kurzinfo</span>
</div>
<div class="col-4 text-right">
<span class="product-info-price">CHF 34.00</span>
</div>
</div>
</div>
</div>
</div>
<div class="swiper-slide">
<img src="http://www.placehold.it/80x130">
<div class="product-info-wrapper">
<div class="product-info">
<div class="row no-gutters">
<div class="col-8">
<strong class="text-uppercase">Whey Isolat CFM</strong>
<span class="product-info-link">Kurzinfo</span>
</div>
<div class="col-4 text-right">
<span class="product-info-price">CHF 34.00</span>
</div>
</div>
</div>
<div class="product-badge-wrapper">
<div class="product-badge">
<div class="product-badge-content text-small">
nicht<br>auf lager
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="product-focus-prev"><i class="fa fa-chevron-left"></i></div>
<div class="product-focus-next"><i class="fa fa-chevron-right"></i></div>
</div>
</div>
</div>
I hope my question was clear enough. If you need more details, please let me know!

You can add:
.swiper-slide {
padding-bottom: 30px;
}
where 30px is the value your badge should be beyond the border.
http://codepen.io/Deka87/pen/xqYXOq

I found a solution, I feel like it's a bit of a hack, however. For what it's worth, here it is:
.swiper-container {
overflow: visible;
}
$slide: ".swiper-slide";
.swiper-slide {
opacity: 0;
visibility: hidden;
transition: opacity 200ms ease-in-out, visibility 200ms ease-in-out;
&-active {
opacity: 1;
visibility: visible;
#for $i from 1 through 3 {
& + #{$slide} {
opacity: 1;
visibility: visible;
}
$slide: "#{$slide} + .swiper-slide";
}
}
}
So, what I do here is setting .swiper-container from overflow: hidden; to overflow: visible and then I tell every .swiper-slide to have opacity: 0; except for the &-active one. I then use the &-active slide as a starting point and iterate through a sass for-loop 3 times to add opacity: 1; for the next 3 .swiper-slides. This sass code produces the following pure css code (.swiper-container not included here)
.swiper-slide {
opacity: 0;
visibility: hidden;
transition: opacity 200ms ease-in-out, visibility 200ms ease-in-out;
}
.swiper-slide-active {
opacity: 1;
visibility: visible;
}
.swiper-slide-active + .swiper-slide {
opacity: 1;
visibility: visible;
}
.swiper-slide-active + .swiper-slide + .swiper-slide {
opacity: 1;
visibility: visible;
}
.swiper-slide-active + .swiper-slide + .swiper-slide + .swiper-slide {
opacity: 1;
visibility: visible;
}
This whole stuff is just to remove the overflow: hidden; from .swiper-container while still showing only the slides I need to see and hiding the others.
Now I can play around with the height of the Infobox and the effect I was looking for works.

<style>
//as we want to see details which are being cut of by default css from swiper contner we change it top overflow visible.
.swiper-container {
overflow: visible;
}
//we changed over hidden to visible all slides of the swiper slider would we visible so we need to hide them so we add below css.
.swiper-slide{
opacity: 0;
visibility: hidden;
}
// now because of the above css all the slider are set to opacity 0 , which makes them not visible, now as we want to see out active and next slide we supply below css by using their name. and set there opacity to 1.
.swiper-slide.swiper-slide-active,.swiper-slide.swiper-slide-next,.swiper-slide.swiper-slide-prev{
opacity: 1;
visibility: visible;
}
</style>

I recently had a similar problem in my react project and solved it by wrapping up the whole swiper component with a div and giving it the following properties:
.sliderContainer { position: relative; z-index: 2; height: 25rem; }
Another thing you gotta do is remove position: relative; from .swiper class like this:
.swiper { position: unset !important; }
Doing this will allow you to bypass the overflow: hidden; of .swiper class and essentially will bind child elements to the wrapper div and you'll be able to expand your div as much as you'd like without it being cropped off by the slider.
Also when defining a height for the slider, you should add it to the wrapper div you created instead of adding it to .swiper.

You can use custom padding, margin.
.swiper {
padding: 13px !important;
margin: -13px !important;
}

Related

How to overlap the menu with text when popping up without js?

I need a animated menu without js.
I create it using "transform" tag.
But Problem is : Footer menu not hidden by label after opened.
Searches not given any results.
Footer also has gradient color otherwise I'd hide it with a color block
I try play with z-index but no results
Must be
At the moment, the menu appears at the top of the label, but should be at the bottom.
How do I make the menu appear at the bottom or overlap with the label?
#media (max-width:992px) {
footer {
line-height: 2.2
}
.taber {
border-bottom: 1px solid #ccc;
padding-bottom: 10px;
margin-bottom: 5px;
position: relative
}
.taber:after {
content: '';
width: 10px;
height: 10px;
position: absolute;
border-top: 1px solid #fff;
border-right: 1px solid #fff;
transform: rotate(45deg);
top: 12px;
right: 5px;
float: right;
transition: transform .5s
}
.taber {
cursor: pointer
}
footer :checked+div .mblock {
position: initial;
visibility: visible;
z-index: 1;
transform: none;
transition: transform .5s
}
footer .mblock {
position: absolute;
overflow: hidden;
visibility: hidden;
z-index: -1;
transform: translateY(-80px)
}
:checked+div .taber:after {
transform: rotateZ(135deg)
}
}
.top {
overflow: hidden;
z-index: 2;
position: relative
}
.bg-gradient-inv {
background: linear-gradient(180deg, blue,#003);
}
footer {
background: #003;
color: white
}
.tr {
color: white
}
.hide {
display: none
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" />
Click to footer to view the problem
<br> more text body
<footer class="pt-4 px-4 pb-5 pt-5 bg-gradient-inv">
<div class=container>
<div class=row>
<div class="col-12 col-lg-2 top">
<input class="hide" type="checkbox" id="f1">
<div>
<div class="col-12 top"><label class="small nw tr taber pt-2 d-block" for=f1>Footer</label></div>
<div class=mblock>
<div class="col-12"><a class="small nw tr d-block" href=/>1</a>
</div>
<div class="col-12"><a class="small nw tr d-block" href=/>2</a>
</div>
<div class="col-12"><a class="small nw tr d-block" href=/>3</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
This is very unclear but from what i've understand you should have a div wrapping mblock. This div would have the size of mblock and overflow hidden. This div would not move, but mblock would move inside it. So when mblock is outside of it, it would not appear.
#media (max-width:992px) {
footer {
line-height: 2.2
}
.taber {
border-bottom: 1px solid #ccc;
padding-bottom: 10px;
margin-bottom: 5px;
position: relative
}
.taber:after {
content: '';
width: 10px;
height: 10px;
position: absolute;
border-top: 1px solid #fff;
border-right: 1px solid #fff;
transform: rotate(45deg);
top: 12px;
right: 5px;
float: right;
transition: transform .5s
}
.taber {
cursor: pointer
}
footer :checked+div .mblock {
position: initial;
visibility: visible;
z-index: 1;
transform: none;
transition: transform .5s
}
footer .mblock {
position: absolute;
overflow: hidden;
visibility: hidden;
z-index: -1;
transform: translateY(-80px)
}
:checked+div .taber:after {
transform: rotateZ(135deg)
}
}
.top {
overflow: hidden;
z-index: 2;
position: relative
}
.bg-gradient-inv {
background: linear-gradient(180deg, blue,#003);
}
.mblock_wrapper{
overflow:hidden;
}
footer {
background: #003;
color: white
}
.tr {
color: white
}
.hide {
display: none
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" />
Click to footer to view the problem
<br> more text body
<footer class="pt-4 px-4 pb-5 pt-5 bg-gradient-inv">
<div class=container>
<div class=row>
<div class="col-12 col-lg-2 top">
<input class="hide" type="checkbox" id="f1">
<div>
<div class="col-12 top"><label class="small nw tr taber pt-2 d-block" for=f1>Footer</label></div>
<div class ="mblock_wrapper">
<div class=mblock>
<div class="col-12"><a class="small nw tr d-block" href=/>1</a>
</div>
<div class="col-12"><a class="small nw tr d-block" href=/>2</a>
</div>
<div class="col-12"><a class="small nw tr d-block" href=/>3</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

Is it possible to divide 1 image gallery on a page into 2 or multiple image galleries?

I got the following piece of code:
img {
object-fit: contain;
width: 250px !important;
height: 200px !important;
border: 3px solid #555;
}
img.zoomable {
object-fit: contain;
width: 600px !important;
height: 600px !important;
}
.portfolio .portfolio-item {
margin-bottom: 30px;
}
.portfolio #portfolio-flters {
padding: 0;
margin: 0 auto 25px auto;
list-style: none;
text-align: center;
background: #fff;
border-radius: 50px;
padding: 2px 15px;
}
.portfolio #portfolio-flters li {
cursor: pointer;
display: inline-block;
padding: 10px 15px;
font-size: 14px;
font-weight: 600;
line-height: 1;
text-transform: uppercase;
color: #272829;
margin-bottom: 5px;
transition: all 0.3s ease-in-out;
}
.portfolio #portfolio-flters li:hover,
.portfolio #portfolio-flters li.filter-active {
color: #0563bb;
}
.portfolio #portfolio-flters li:last-child {
margin-right: 0;
}
.portfolio .portfolio-wrap {
transition: 0.3s;
position: relative;
overflow: hidden;
z-index: 1;
}
.portfolio .portfolio-wrap::before {
content: "";
background: rgba(255, 255, 255, 0.7);
position: absolute;
left: 30px;
right: 30px;
top: 30px;
bottom: 30px;
transition: all ease-in-out 0.3s;
z-index: 2;
opacity: 0;
}
.portfolio .portfolio-wrap .portfolio-info {
opacity: 0;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
text-align: center;
z-index: 3;
transition: all ease-in-out 0.3s;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.portfolio .portfolio-wrap .portfolio-info::before {
display: block;
content: "";
width: 48px;
height: 48px;
position: absolute;
top: 35px;
left: 35px;
border-top: 3px solid #d7dce1;
border-left: 3px solid #d7dce1;
transition: all 0.5s ease 0s;
z-index: 9994;
}
.portfolio .portfolio-wrap .portfolio-info::after {
display: block;
content: "";
width: 48px;
height: 48px;
position: absolute;
bottom: 35px;
border-bottom: 3px solid #d7dce1;
border-right: 3px solid #d7dce1;
transition: all 0.5s ease 0s;
z-index: 9994;
}
.portfolio .portfolio-item {
max-width: 250px !important;
}
.portfolio .portfolio-wrap .portfolio-info h4 {
font-size: 20px;
color: #45505b;
font-weight: 600;
}
.portfolio .portfolio-wrap .portfolio-info p {
color: #45505b;
font-size: 14px;
text-transform: uppercase;
padding: 0;
margin: 0;
}
.portfolio .portfolio-wrap .portfolio-links {
text-align: center;
z-index: 4;
}
.portfolio .portfolio-wrap .portfolio-links a {
color: #45505b;
margin: 0 2px;
font-size: 28px;
display: inline-block;
transition: 0.3s;
}
.portfolio .portfolio-wrap .portfolio-links a:hover {
color: #148af9;
}
.portfolio .portfolio-wrap:hover::before {
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 1;
}
.portfolio .portfolio-wrap:hover .portfolio-info {
opacity: 1;
}
.portfolio .portfolio-wrap:hover .portfolio-info::before {
top: 15px;
left: 15px;
}
.portfolio .portfolio-wrap:hover .portfolio-info::after {
bottom: 15px;
right: 15px;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.3.1/dist/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.14.7/dist/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#4.3.1/dist/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<section id="portfolio" class="portfolio section-bg">
<div class="container" data-aos="fade-up">
<div class="row portfolio-container" data-aos="fade-up" data-aos-delay="200">
<div class="col-lg-4 col-md-6 portfolio-item filter-app">
<div class="portfolio-wrap">
<img src="assets/img/portfolio/portfolio-1.jpg">
<div class="portfolio-info">
<div class="portfolio-links">
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 portfolio-item filter-web">
<div class="portfolio-wrap">
<img src="assets/img/portfolio/portfolio-2.jpg">
<div class="portfolio-info">
<div class="portfolio-links">
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 portfolio-item filter-app">
<div class="portfolio-wrap">
<img src="assets/img/portfolio/portfolio-3.jpg">
<div class="portfolio-info">
<div class="portfolio-links">
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 portfolio-item filter-card">
<div class="portfolio-wrap">
<img src="assets/img/portfolio/portfolio-4.jpg">
<div class="portfolio-info">
<div class="portfolio-links">
<i class="bx bx-zoom-in"></i>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 portfolio-item filter-web">
<div class="portfolio-wrap">
<img src="assets/img/portfolio/portfolio-5.jpg" class="img-fluid" alt="">
<div class="portfolio-info">
<div class="portfolio-links">
<i class="bx bx-zoom-in"></i>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 portfolio-item filter-app">
<div class="portfolio-wrap">
<img src="assets/img/portfolio/portfolio-6.jpg" class="img-fluid" alt="">
<div class="portfolio-info">
<div class="portfolio-links">
<i class="bx bx-zoom-in"></i>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 portfolio-item filter-card">
<div class="portfolio-wrap">
<img src="assets/img/portfolio/portfolio-7.jpg" class="img-fluid" alt="">
<div class="portfolio-info">
<div class="portfolio-links">
<i class="bx bx-zoom-in"></i>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 portfolio-item filter-card">
<div class="portfolio-wrap">
<img src="assets/img/portfolio/portfolio-8.jpg" class="img-fluid" alt="">
<div class="portfolio-info">
<div class="portfolio-links">
<i class="bx bx-zoom-in"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
This creates a nice image gallery where you can click on a picture and it zooms in once you have clicked.
The point is, when I click on an image it goes trough all 6 of the images. For example I only want to scroll to 3 of the images and then click on another picture and scroll trough those 3 of the other gallery.
I already tried making seperate divs and tried using the same code to replicate it but then it took all 12 pictures and scrolled trough them. How am I able to make these into seperate galleries?
Thanks in advance!
I already tried making seperate divs and tried using the same code to replicate it but then it took all 12 pictures and scrolled trough them. How am I able to make these into seperate galleries?
Also looked at multiple image galleries on one page
And
Modal image galleries with multiple images
But these aren't really what im looking for..
I'm still a little noob in front-end so please let me know if you need more information.

image overlay hover effect using uikit

.destination {
position: relative;
}
.dest-topic{
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.3);
color: #fff;
visibility: hidden;
display: flex;
align-items: center;
justify-content: center;
}
.destination:hover .dest-topic {
visibility: visible;
padding:0px !important;
}
.dest-title {
color: white;
font-size: 18px;
transition: .1s;
transform: translateY(1em);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.26/js/uikit-icons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.26/js/uikit.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.26/css/uikit.min.css" rel="stylesheet"/>
<div class=" uk-child-width-1-2 uk-padding-xsmall uk-child-height-1-2 " uk-grid="">
<div class="uk-first-column">
<div class="uk-child-width-expand#s uk-padding-xsmall uk-text-center " uk-grid="">
<div class="uk-first-column uk-panel uk-padding-xsmall destination">
<img src="https://source.unsplash.com/1200x500/?heli"alt="" class="dest-image">
<div class="dest-topic">
<div class="dest-title">Annapurna Base Camp</div>
</div>
</div>
</div>
</div>
<div>
<div class="uk-child-width-expand#s uk-text-center " uk-grid="">
<div class="uk-panel uk-padding-xsmall destination">
<img src="https://source.unsplash.com/1200x500/?annapurna" alt="" class="dest-image">
<div class="dest-topic">
<div class="dest-title">Everest Base Camp</div>
</div>
</div>
</div>
</div>
</div>
This code is written in uikit framework. There are two uikit image. When I hover the image, overlay background image color come out. I want to remove that extra overlay background image color. It shows exact the image only. when I hover the image. It cover only the background-image.
Set left:30px in .dest-topic, because left 30px padding given in .uk-grid>* class
.destination {
position: relative;
}
.dest-topic {
position: absolute;
top: 0;
bottom: 0;
left: 30px;
right: 0;
background: rgba(0, 0, 0, 0.3);
color: #fff;
visibility: hidden;
display: flex;
align-items: center;
justify-content: center;
}
.destination:hover .dest-topic {
visibility: visible;
padding:0px !important;
}
.dest-title {
color: white;
font-size: 18px;
transition: .1s;
transform: translateY(1em);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.26/js/uikit-icons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.26/js/uikit.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.26/css/uikit.min.css" rel="stylesheet"/>
<div class=" uk-child-width-1-2 uk-padding-xsmall uk-child-height-1-2 " uk-grid="">
<div class="uk-first-column">
<div class="uk-child-width-expand#s uk-padding-xsmall uk-text-center " uk-grid="">
<div class="uk-first-column uk-panel uk-padding-xsmall destination">
<img src="https://source.unsplash.com/1200x500/?heli"alt="" class="dest-image">
<div class="dest-topic">
<div class="dest-title">Annapurna Base Camp</div>
</div>
</div>
</div>
</div>
<div>
<div class="uk-child-width-expand#s uk-text-center " uk-grid="">
<div class="uk-panel uk-padding-xsmall destination">
<img src="https://source.unsplash.com/1200x500/?annapurna" alt="" class="dest-image">
<div class="dest-topic">
<div class="dest-title">Everest Base Camp</div>
</div>
</div>
</div>
</div>
</div>

Padding on a Bootstrap 3 col seems impossible to remove

I am having some big problems with padding. Before the description of my problem make sense, there is 2 pages to see in the inspector window - and look in the mobile view device section:
1: This demopage is working as it should.
2: This demopage is not working.
The difference between the 2 pages is that I added one more row with three pictures in it. The row with 3 pictures is basic builded up like this:
<div class="row wrapping">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-8 margin_bottom">
<!-- Picture 1 -->
</div>
<div class="col-sm-4">
<div class="row">
<div class="col-sm-12 margin_bottom">
<!-- Picture 2 -->
</div>
</div>
<div class="row">
<div class="col-sm-12 margin_bottom">
<!-- Picture 3 -->
</div>
</div>
</div>
</div>
</div>
</div>
As I see it there is set a padding on the inner columns col > row > col? How can I remove that padding? I removed the padding on the rows with the below code, and thought that would also count for all columns.
.row.wrapping {
margin-right: 0;
margin-left: 0;
}
.wrapping > [class^="col-"], .wrapping > [class^=" col-"] {
padding-right: 0;
padding-left: 0;
}
The most important thing is that I cannot start overwriting Bootstrap classes since the whole site is building up with bootstrap. So every change I am overwriting in the bootstrap framework has to be named unique.
#front .row {
padding-bottom: 0px!important;
}
body {
background-color: #f5f5f5;
}
/* Removes default right padding */
.row.wrapping {
margin-right: 0;
margin-left: 0;
}
.wrapping>[class^="col-"],
.wrapping>[class^=" col-"] {
padding-right: 0;
padding-left: 0;
}
/* Set width between grid elements */
.small-padding.top {
padding-top: 10px;
}
.small-padding.bottom {
padding-bottom: 10px;
}
.small-padding.left {
padding-left: 5px;
}
.small-padding.right {
padding-right: 5px;
}
.margin_bottom {
margin-bottom: 10px;
}
.img-responsive {
height: 100%;
}
/* Position of buttons/text in a single grid element */
.inner-wrapper {
background: none;
}
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.bottom-right {
position: absolute;
bottom: 8px;
right: 16px;
}
.bottom-left {
position: absolute;
bottom: 2%;
left: 6%;
}
/* Position text on full width banner */
.header-container {
color: white;
margin: 0 5%;
}
.banner-text {
position: absolute;
bottom: 3%;
left: 1%;
width: 80%;
}
/* Color on text */
.dark-font {
color: #333;
}
.light-font {
color: #fff;
text-transform: uppercase;
}
.blue-font {
color: #00a9ff;
text-transform: uppercase;
margin-top: -10px;
}
/* Set full width on columns */
#media (max-width: 768px) {
.img-responsive {
width: 100%;
height: auto;
}
/* btn-success: */
.btn-success {
width: fit-content;
}
}
#media (max-width: 991px) {
h3 {
font-size: 1.2em;
}
}
/* Hover for grid elements that contains text */
.hovereffect {
display: inline-block;
overflow: hidden;
position: relative;
text-align: center;
cursor: default;
}
.hovereffect .overlay {
width: 100%;
height: 100%;
position: absolute;
overflow: hidden;
top: 0;
left: 0;
transition: all 0.4s ease-in-out;
}
.hovereffect:hover .overlay {
background-color: rgba(170, 170, 170, 0.4);
}
.hovereffect h2,
.hovereffect img {
transition: all 0.4s ease-in-out;
}
.hovereffect img {
display: block;
position: relative;
transform: scale(1.1);
}
.hovereffect:hover img {
transform: scale(1);
}
.hovereffect h2 {
text-transform: uppercase;
color: #fff;
text-align: center;
position: relative;
font-size: 17px;
padding: 10px;
background: rgba(0, 0, 0, 0.6);
}
.hovereffect p.info {
text-decoration: none;
color: #fff;
border: 1px solid #fff;
background-color: transparent;
opacity: 0;
transform: scale(1.5);
transition: all 0.4s ease-in-out;
font-weight: normal;
height: 90%;
width: 90%;
top: 5%;
/* (100% - 85%)/2 */
left: 5%;
position: absolute;
text-align: left;
padding: 20px 20px 20px 20px;
}
.hovereffect:hover p.info {
opacity: 1;
transform: scale(1);
background-color: rgba(0, 0, 0, 0.4);
}
/* Hover fadeout head and subline */
.hovereffect:hover .inner-wrapper.bottom-left h3,
.hovereffect:hover .inner-wrapper.bottom-left span {
transition: all 0.4s ease-in-out;
}
.hovereffect:hover .inner-wrapper.bottom-left h3,
.hovereffect:hover .inner-wrapper.bottom-left span {
opacity: 0;
}
/* Hover opacity for grid elements without text*/
.column {
padding: 0;
}
.column:last-child {
padding-bottom: 60px;
}
.column::after {
content: '';
clear: both;
display: block;
}
.column div {
position: relative;
float: left;
width: 300px;
height: 200px;
margin: 0 0 0 25px;
padding: 0;
}
.column div:first-child {
margin-left: 0;
}
figure {
margin: 0;
padding: 0;
background: #fff;
}
figure:hover+span {
bottom: -36px;
opacity: 1;
}
/* Opacity #1 */
.hover11 figure img {
opacity: 1;
-webkit-transition: .3s ease-in-out;
transition: 0.8s ease-in-out;
}
.hover11 figure:hover img {
opacity: .5;
}
<div class="wrapper">
<div class="row wrapping">
<div class="col-xs-12 col-sm-12 margin_bottom">
<!--<div class="hover11 column">-->
<a href="#">
<picture>
<source media="(min-width: 650px)" srcset="https://mimsi.dk/Static/Cms/d211428c-7ea9-4805-8b66-ee73d7f1df2d.jpg"></source>
<source media="(min-width: 320px)" srcset="https://mimsi.dk/Static/Cms/b1cbb0f1-9e91-4d55-8a8e-65631432c38b.jpg"></source>
<img src="http://mimsi.dk/Static/Cms/d211428c-7ea9-4805-8b66-ee73d7f1df2d.jpg" alt="mimsi Partnerværksteder" style="width:100%;"></img>
</picture>
<div class="inner-wrapper banner-text">
<div class="header-container">
<h2 class="blue-font" style="text-shadow: 2px 2px #000000;">Find nærmeste mimsi </h2>
<p class="light-font" style="text-shadow: 2px 2px #000000;">#</p>
<!--<span class="btn btn-primary" role="button">Lorem Ipsum</span>-->
</div>
</div>
</a>
<!--</div>-->
</div>
</div>
<!-- DELETE THIS ROW IN THE INSPECT WINDOW -->
<div class="row wrapping">
<div class="col-sm-12">
<div class="row">
<a href="/da-dk/page/bmw-packages/">
<div class="col-sm-8 margin_bottom">
<div class="hover11 column">
<figure>
<picture>
<source media="(min-width: 650px)" srcset="https://mimsi.dk/Static/Cms/f30dfbf6-047a-4aa4-829f-48d4223d05be.jpg"></source>
<source media="(min-width: 320px)" srcset="https://mimsi.dk/Static/Cms/ce50c03a-0e95-4760-95a4-e2ad2a1b6e43.jpg"></source>
<img src="https://mimsi.dk/Static/Cms/f30dfbf6-047a-4aa4-829f-48d4223d05be.jpg" alt="Lorem Ipsum" style="width:100%;"></img>
</picture>
</figure>
</div>
<div class="inner-wrapper bottom-left">
<h3 class="light-font" style="color:#333">Lorem Ipsum</h3>
<span class="light-font" style="color:#00a9ff">Lorem Ipsum</span>
<!--<button class="btn btn-success btn-lg">Læs mere</button>-->
</div>
</div>
</a>
<div class="col-sm-4">
<div class="row">
<a href="#">
<div class="col-sm-12 margin_bottom">
<div class="hover11 column">
<figure>
<img src="https://mimsi.dk/Static/Cms/7da4b142-e174-4dd4-aa44-cb175c1f92f0.jpg" alt="mimsi Lorem Ipsum" class="img-responsive"></img>
</figure>
</div>
<div class="inner-wrapper bottom-left">
<h4 class="light-font" style="color:#00a9ff">Vi er eneforhandler I Danmark</h4>
<span class="light-font">Lorem Ipsum</span>
<!--<button class="btn btn-success btn-lg">Læs mere</button>-->
</div>
</div>
</a>
</div>
<div class="row">
<a href="#">
<div class="col-sm-12 margin_bottom">
<div class="hover11 column">
<figure>
<a href="#" data-toggle="modal" data-target="#nyhedsbrev-tilmelding">
<img src="https://mimsi.dk/Static/Cms/d065fdf8-a5b1-4137-ba54-74c351185d36.jpg" alt="Signup newsletter" class="img-responsive"></img>
</a>
</figure>
</div>
<div class="modal fade" id="nyhedsbrev-tilmelding" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div id="mc_embed_signup">
</div>
</div>
</div>
</div>
</div>
<div class="inner-wrapper bottom-left"></div>
</div>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
I'm not sure what you want to achieve, but for me, if you make a very little change at page https://koed.dk/da-dk/page/stack like below, then effect is great:
.row.wrapping,
.row.wrapping .row {
margin-left: -5px;
margin-right: -5px;
}
.wrapping [class^=col-] {
padding-left: 5px;
padding-right: 5px;
}
Brother in your styles you have this code .
.margin_bottom {
margin-bottom: 10px;
}
Remove it. That'll solve your problem.
One solution to your problem is that make a new css class no-padding like this
.no-padding{
padding-right: 0!important;
padding-left: 0!important;
}
And then add the no-padding class to your html row or col for which you want to remove padding like this.
<div class="row wrapping">
<div class="col-sm-12 no-padding"> <!-- notice here -->
<div class="row">
<div class="col-sm-8 margin_bottom no-padding"><!-- notice here -->
<!-- Picture 1 -->
</div>
<div class="col-sm-4 no-padding"><!-- notice here -->
<div class="row">
<div class="col-sm-12 margin_bottom no-padding"><!-- notice here -->
<!-- Picture 2 -->
</div>
</div>
<div class="row">
<div class="col-sm-12 margin_bottom no-padding"><!-- notice here -->
<!-- Picture 3 -->
</div>
</div>
</div>
</div>
</div>
</div>
In this way you won't have to override the bootstrap classes and you won't break the layout.

How to properly position divs for overlay hover effect with text underneath

I have two rows of 4-boxed divs. The goal is to have a header within each box, and then hovering over the box will present more detailed p text with a faded background. I'm close, I just can't figure out how to actually layer the span overlay on top of the div instead of it being padded out of the way. Any help would be hugely appreciated!
.box {
width: 200px;
float: left;
box-shadow: inset 1px 1px 40px 0 rgba(90, 90, 90, .25);
margin: 5% auto 0 auto;
background-color: #DE5D40;
background-size: cover;
border-radius: 5px;
overflow: hidden;
}
.overlay {
background: rgba(0, 0, 0, .75);
text-align: center;
padding: 45px 0 66px 0;
opacity: 0;
-webkit-transition: opacity .25s ease;
-moz-transition: opacity .25s ease;
z-index: 10;
}
.box:hover .overlay {
opacity: 1;
}
.overlayText {
font-family: Helvetica;
font-weight: 14;
color: rgba(255, 255, 255, .85);
font-size: 14px;
}
.one-fourth.box {
margin-bottom: 20px;
height: 130px;
}
/* Column Classes
Link: http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css
--------------------------------------------- */
.five-sixths,
.four-sixths,
.one-fourth,
.one-half,
.one-sixth,
.one-third,
.three-fourths,
.three-sixths,
.two-fourths,
.two-sixths,
.two-thirds {
float: left;
margin-left: 2.564102564102564%;
}
.one-half,
.three-sixths,
.two-fourths {
width: 48.717948717948715%;
}
.one-third,
.two-sixths {
width: 31.623931623931625%;
}
.four-sixths,
.two-thirds {
width: 65.81196581196582%;
}
.one-fourth {
width: 23.076923076923077%;
}
.three-fourths {
width: 74.35897435897436%;
}
.one-sixth {
width: 14.52991452991453%;
}
.five-sixths {
width: 82.90598290598291%;
}
.first {
clear: both;
margin-left: 0;
}
<div class="one-fourth first box box1">
<h3>SEO</h3>
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box2">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box3">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box4">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth first box box5">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box6">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box7">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box8">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
Check the code below should be what your after.
They key here is positioning.
What you want is a box that overlays its container and has text in the dead center.
In these instances position:absolute & position:relative mean everything.
A small understanding of relativity would help in this situation but until you crack open a copy of the theory of relativity you can have this.
Your container will be relatively positioned. this means it is positioned relatively to the content surrounding it. But it also has a second cascaded function.
It tell's an absolutely positioned element to behave Absolutely relative to its container.
so when this happens we can use top,bottom,left & right to control where it should sit in the container absolutely.
so what we want to happen is for your text to sit dead center so in this case we tell it to have top,left,bottom & right 0px & margin:auto;
This will tell your element that it is not taking positioning rules from any one point of your container and it wants its marginalizing to be automatically thought out, but since you have defined all the axis that it can be positioned from it will margin it to the center.
Hope it help's you understand a little on why this happens.
.box {
position: relative;
width: 200px;
float: left;
box-shadow: inset 1px 1px 40px 0 rgba(90, 90, 90, .25);
margin: 5% auto 0 auto;
background-color: #DE5D40;
background-size: cover;
border-radius: 5px;
overflow: hidden;
}
.overlay {
top: 0px;
left: 0px;
position: absolute;
background: rgba(0, 0, 0, .75);
text-align: center;
opacity: 0;
-webkit-transition: opacity .25s ease;
-moz-transition: opacity .25s ease;
z-index: 10;
width:100%;
height:inherit;
}
.box:hover .overlay {
opacity: 1;
}
.overlayText {
position: absolute;
margin: auto;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
font-family: Helvetica;
font-weight: 14;
color: rgba(255, 255, 255, .85);
font-size: 14px;
height:15px;
}
.one-fourth.box {
margin-bottom: 20px;
height: 130px;
}
/* Column Classes
Link: http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css
--------------------------------------------- */
.five-sixths,
.four-sixths,
.one-fourth,
.one-half,
.one-sixth,
.one-third,
.three-fourths,
.three-sixths,
.two-fourths,
.two-sixths,
.two-thirds {
float: left;
margin-left: 2.564102564102564%;
}
.one-half,
.three-sixths,
.two-fourths {
width: 48.717948717948715%;
}
.one-third,
.two-sixths {
width: 31.623931623931625%;
}
.four-sixths,
.two-thirds {
width: 65.81196581196582%;
}
.one-fourth {
width: 23.076923076923077%;
}
.three-fourths {
width: 74.35897435897436%;
}
.one-sixth {
width: 14.52991452991453%;
}
.five-sixths {
width: 82.90598290598291%;
}
.first {
clear: both;
margin-left: 0;
}
<div class="one-fourth first box box1">
<h3>SEO</h3>
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box2">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box3">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box4">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth first box box5">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box6">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box7">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box8">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
If i understand your problem correctly you need to use position:absolute for your .overlay div to position it on top of your .box div.
You can try this:
.box { position: relative}
.overlay{position:absolute;
top:0px;
left:0px}
Do this:
.box {
position:relative;
}
.overlay {
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
}