trouble about image slider html CSS - html

dudes.
have made my image slider, but the first click doesn’t trigger an animation. It just jumps to the target. I want to smoothly changing of picture, but the firs just jump.
To understand my question better, go to
http://labs.qnimate.com/slider/#slider-image-3 and pay attention to animation between images.
here is html-code:
<div class="slider-holder">
<span id="slider-image-1"></span>
<span id="slider-image-2"></span>
<span id="slider-image-3"></span>
<div class="image-holder">
<img src="images/slide1.jpg" class="slider-image" />
<img src="images/slide2.jpg" class="slider-image" />
<img src="images/slide3.jpg" class="slider-image" />
</div>
<div class="button-holder">
</div>
</div>
and here is CSS:
.slider-holder
{
width: 800px;
height: 400px;
background-color: yellow;
margin-left: auto;
margin-right: auto;
margin-top: 0px;
text-align: center;
overflow: hidden;
}
.image-holder
{
width: 2400px;
background-color: red;
height: 400px;
clear: both;
position: relative;
-webkit-transition: left 2s;
-moz-transition: left 2s;
-o-transition: left 2s;
transition: left 2s;
}
.slider-image
{
float: left;
margin: 0px;
padding: 0px;
position: relative;
}
#slider-image-1:target ~ .image-holder
{
left: 0px;
}
#slider-image-2:target ~ .image-holder
{
left: -800px;
}
#slider-image-3:target ~ .image-holder
{
left: -1600px;
}
.button-holder
{
position: relative;
top: -20px;
}
.slider-change
{
display: inline-block;
height: 10px;
width: 10px;
border-radius: 5px;
background-color: brown;
}
Is there a way to fix that?
Than for all of you for helping me.

Change this bit:
#slider-image-1:target ~ .image-holder {
left: 0px;
}
to
#slider-image-1 ~ .image-holder {
left: 0px;
}

Here is given image width and second image width added. you check your image width and change as per your images. Given demo is working correct

Related

Wrapper div for image containing text cannot both change brightness filter on image AND change opacity filter on text

Here's my code:
HTML
<div id="featuredWrapper">
<div id="featuredContentWrapper">
<div class="ContentThumbnail">
<a>
<div class="ContentThumbnailCaption">
<h3>Lorem</h3>
<p>Ipsum</p>
</div>
<img src="https://i.picsum.photos/id/1/200/300.jpg" class="ContentThumbnailImage" />
</a>
</div>
</div>
</div>
CSS
#featuredWrapper
{
/*SETUP*/
display:inline-block;
margin-left:13.85%;
margin-right:13.85%;
width:72.3%;
/*BORDER*/
border-bottom: solid 1px gray;
/*ANIMATION*/
transition: 0.3s;
}
#featuredContentWrapper
{
/*SETUP*/
text-align:center;
}
.ContentThumbnail
{
/*SETUP*/
display:inline-block;
height: 30%;
width: 22.5%;
margin: 2% 4% 2% 4%;
/*VISUAL*/
background-color:aqua;
/*ANIMATION*/
transition: 0.3s;
}
.ContentThumbnail:hover .ContentThumbnailCaption
{
/*VISUAL*/
filter:opacity(100%);
}
.ContentThumbnail:hover .ContentThumbnailImage
{
/*VISUAL*/
filter:brightness(50%);
}
.ContentThumbnail a
{
/*SETUP*/
display:inline-block;
position:relative;
}
.ContentThumbnailImage
{
/*SETUP*/
display:inline-block;
height: 100%;
width: 100%;
}
.ContentThumbnailCaption
{
/*SETUP*/
position:absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
/*VISUAL*/
color:white;
filter:opacity(0);
/*ANIMATION*/
transition:0.3s;
}
I would like for the brightness and opacity changes to occur concurrently, so that the text would display over the darkened image.
As it stands now, I think either the brightness filter is somehow hiding the text or the effects are occurring one after another because when you stop hovering, the text will appear and play the fading out animation.
I have tried changing the mechanisms used to do both effects, like using visibility CSS instead of filters. I haven't tried JavaScript yet, but I would like to keep this effect within CSS.
Changed for below mentioned css
.ContentThumbnail:hover .ContentThumbnailCaption
{
/*VISUAL*/
filter:opacity(100%);z-index:1;
}
#featuredWrapper {
/*SETUP*/
display: inline-block;
margin-left: 13.85%;
margin-right: 13.85%;
width: 72.3%;
/*BORDER*/
border-bottom: solid 1px gray;
/*ANIMATION*/
transition: 0.3s;
}
#featuredContentWrapper {
/*SETUP*/
text-align: center;
}
.ContentThumbnail {
/*SETUP*/
display: inline-block;
height: 30%;
width: 22.5%;
margin: 2% 4% 2% 4%;
/*VISUAL*/
background-color: aqua;
/*ANIMATION*/
transition: 0.3s;
}
.ContentThumbnail:hover .ContentThumbnailCaption {
/*VISUAL*/
filter: opacity(100%);
z-index: 1;
}
.ContentThumbnail:hover .ContentThumbnailImage {
/*VISUAL*/
filter: brightness(50%);
}
.ContentThumbnail a {
/*SETUP*/
display: inline-block;
position: relative;
}
.ContentThumbnailImage {
/*SETUP*/
display: inline-block;
height: 100%;
width: 100%;
}
.ContentThumbnailCaption {
/*SETUP*/
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
/*VISUAL*/
color: white;
filter: opacity(0);
/*ANIMATION*/
transition: 0.3s;
}
<div id="featuredWrapper">
<div id="featuredContentWrapper">
<div class="ContentThumbnail">
<a>
<div class="ContentThumbnailCaption">
<h3>Lorem</h3>
<p>Ipsum</p>
</div>
<img src="https://i.picsum.photos/id/1/200/300.jpg" class="ContentThumbnailImage" />
</a>
</div>
</div>
</div>

CSS - transform divs pushing other divs around

I'm trying to do a thumbnail page with a hover transition that zooms and displays a description. EDIT: I do not want to use jquery.
Problem 1. The hovered div pushes the neighbor div out of alignment. All the thumbs should stay in nice neat rows.
Problem 2. The hovered div pushes the bottom of the container down.
.container {
margin-top: 75px;
text-align: center;
border: 2px solid black;
padding: 5px;
}
.tn-wrapper {
display: inline-block;
position: relative;
border: 0;
margin: 5px;
height: 150px;
overflow: hidden;
transition: all 200ms ease-in;
transform: scale(1);
}
.tn-wrapper:hover {
z-index: 1;
transition: all 200ms ease-in;
transform: scale(1.5);
height: 300px;
}
.thumb-box {
background: lightgray;
height: 150px;
width: 150px;
}
.descr-box {
background: gray;
height: 150px;
width: 150px;
}
<div class="container">
<div class="tn-wrapper">
<div class="thumb-box">
Thumb
</div>
<div class="descr-box">
Description
</div>
</div>
<div class="tn-wrapper">
<div class="thumb-box">
Thumb
</div>
<div class="descr-box">
Description
</div>
</div>
</div>
You can update your code like below. You fix the alignment of the inline-block elements (not mandatory but to make sure they will stay at the top) and you adjust the height of the description instead of the parent element.
.container {
margin-top: 75px;
text-align: center;
border: 2px solid black;
padding: 5px;
}
.tn-wrapper {
display: inline-block;
position: relative;
border: 0;
margin: 5px;
height: 150px;
transition: all 200ms ease-in;
transform: scale(1);
vertical-align:top; /* added */
}
.tn-wrapper:hover {
z-index: 1;
transition: all 200ms ease-in;
transform: scale(1.5);
}
.thumb-box {
background: lightgray;
height: 150px;
width: 150px;
}
.descr-box {
background: gray;
height: 0;
width: 150px;
overflow:hidden;
transition: all 200ms ease-in;
}
.tn-wrapper:hover .descr-box{
height: 150px;
}
<div class="container">
<div class="tn-wrapper">
<div class="thumb-box">
Thumb
</div>
<div class="descr-box">
Description
</div>
</div>
<div class="tn-wrapper">
<div class="thumb-box">
Thumb
</div>
<div class="descr-box">
Description
</div>
</div>
</div>
I'm not sure if this is the desired look you're trying to achieve but check out this example
I've added a flexbox to your container, changed your transform-origin and utilized the appropriate margins to keep your spacing.
.container {
margin-top: 75px;
text-align: center;
border: 2px solid black;
padding: 5px;
display:flex;
justify-content:center;
}
.tn-wrapper {
display: inline-block;
position: relative;
border: 0;
margin: 5px;
height: 150px;
transition: all 200ms ease-in;
transform: scale(1);
transform-origin:top;
}
.tn-wrapper:hover {
z-index: 1;
transition: all 200ms ease-in;
transform-origin:top;
transform: scale(1.5);
margin:5px 43px 305px 43px;
}

Why is overflow in css working with a delay?

I'm trying to achieve a drop down cover effect (Not sure how it's really called) with the following code:
.new_events_list {
position: absolute;
width: 26%;
height: 28vh;
background-color: #323642;
cursor: pointer;
}
#new_events_list_effect {
background-color: #ee5f95;
width: 100%;
opacity: 0.5;
top: -100%;
transition: 0.5s;
}
div.new_events_list:hover #new_events_list_effect {
top: 0%;
transition: 0.5s;
}
div.new_events_list:hover img {
filter: grayscale(0.5);
transition: 1s;
}
<div class="new_events_list" style="overflow: hidden;border-radius: 10px;">
<img class="new_events_list" id="photo1" src="https://www.dpreview.com/files/p/articles/7395606096/Google-Photos.jpeg" alt="event_list_1" style=" object-fit: cover; width: 100%;border-radius: 10px;">
<div class="new_events_list" id="new_events_list_effect">
</div>
</div>
The problem that I'm facing is that once you hover over the photo the pink block drops down with the corners visible which only disappear after a second or so. Could anyone explain to me how I could possibly drop down the pink coloured div without the corners being visible?
Thank you very much for your help in advance.
The following code should work:
.new_events_list {
position: relative;
width: 26%;
backgorund-color: black;
border-radius: 10px;
overflow: hidden;
}
.image {
width: 100%;
}
.new_events_list_effect {
position: absolute;
height: 100%;
width: 100%;
background-color: #ee5f95;
opacity: 0.5;
top: -100%;
transition: 0.5s;
border-radius: 10px;
}
.new_events_list:hover .new_events_list_effect {
top: 0%;
transition: 0.5s;
}
<div class="new_events_list">
<img src="https://www.dpreview.com/files/p/articles/7395606096/Google-Photos.jpeg" class="image">
<div class="new_events_list_effect"></div>
</div>

Image to Appear Over Image on Hover With CSS

I know this question has been asked before (here and here), but for some reason I can't get mine to work when using the same techniques. Basically when you hover over this,
You should get this:
By the way, if there's a simpler way to do this without loading a new image when hovering, please let me know.
Here's what I tried:
HTML
<div class="image">
<a href="#">
<img class="image" src="wp-content/themes/TheBullshitCollection/Images/bs-1.jpg">
</a>
</div>
CSS
.image {
width: 100%;
margin-right: 28px;
margin-bottom: 28px;
display: inline-block;
}
.image a:hover {
display:block;
background-image:url("/wp-content/themes/TheBullshitCollection/Images/bs-1.5.jpg");
margin-right:28px;
margin-bottom:28px;
transition: all 0.2s ease-in-out;
position: absolute;
z-index:1;
width: 100px;
height: 120px;
}
JS Fiddle Link:
https://jsfiddle.net/ot8a5oba/
You can see that the width and height is also confusing me - I'm not sure how to make sure it stays the same size, and that it appears on top. Thanks in advance!
I would do it like this using a pseudo element to apply an overlay. Simplifies things quite a bit.
.imageContainer a {
width: 100%;
display: inline-block;
position: relative;
}
.imageContainer a:after {
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
background: rgba(139,69,19,0.5);
content: 'Buy';
display: flex;
justify-content: center;
align-items: center;
color: white;
font: 5em cursive;
opacity: 0;
transition: opacity .5s;
}
.imageContainer a:hover:after {
opacity: 1;
}
.imageContainer img {
max-width: 100%;
vertical-align: top;
}
/*
.image a:hover {
display: block;
background-image: url("http://i.imgur.com/ARiA0ua.jpg");
margin-right: 28px;
margin-bottom: 28px;
transition: all 0.2s ease-in-out;
position: absolute;
z-index: 1;
width: 100px;
height: 120px;
}
*/
<div class="imageContainer">
<a href="#">
<img class="image" src="http://i.imgur.com/F2PaGob.jpg">
</a>
</div>

Mozilla and Chrome difference on CSS

I have a problem with my CSS. It works well on chrome but not on Mozilla Firefox.
My code is getting twitter icon to the left, when mouse is over the icons.
My HTML code:
<header>
<div id="animation">
<a href="http://www.facebook.com.tr">
<img id="socialiconface" src="images/facebook.png">
</a>
<a href="http://www.twitter.com.tr">
<img id="socialicon" src="images/twitter.png">
</a>
</div>
</header>
And my CSS is there:
#socialicon {
position: absolute;
-webkit-transition-property: margin-right;
-moz-transition-property: margin-right;
-webkit-transition-duration: 2s;
-moz-transition-duration: 2s;
width: 40px;
height: 40px;
top: 5px;
right: 2px;
}
#socialiconface {
position: absolute;
width: 50px;
height: 50px;
top: 5px;
right: 2px;
}
#socialicon:hover {
margin-right: 70px;
}
Whatever I tried, that doesn't work unfortunately, could someone help me out?
Update this line to cover the whole animation div, otherwise you will have to follow the icon with your mouse for it to animate bacause it moves away.
#animation:hover #socialicon {
margin-right: 70px;
}
Full code:
#socialicon {
position: absolute;
-webkit-transition-property: margin-right;
-moz-transition-property: margin-right;
-webkit-transition-duration:2s;
-moz-transition-duration: 2s;
width:40px;
height: 40px;
top: 5px;
right: 2px;
}
#socialiconface {
position:absolute;
width:50px;
height: 50px;
top: 5px;
right: 2px;
}
#animation:hover #socialicon {
margin-right: 70px;
}
img {
background: #ccc;
}
<header>
<div id="animation">
<img id="socialiconface" src="images/facebook.png" />
<img id="socialicon" src="images/twitter.png" />
</div>
</header>
The reason is because once the img moves past the mouse cursor, the :hover style is no longer applied. Even Chrome does this, but it seems that it doesn't check the :hover state until the mouse moves.
You can try animating right instead of margin and giving some right padding instead:
#socialicon {
position: absolute;
-webkit-transition-property: right;
-moz-transition-property: right;
-webkit-transition-duration: 2s;
-moz-transition-duration: 2s;
width: 40px;
height: 40px;
top: 5px;
right: -68px;
padding-right: 70px
}
#socialiconface {
position: absolute;
width: 50px;
height: 50px;
top: 5px;
right: 2px;
}
#socialicon:hover {
right: 2px;
}
<header>
<div id="animation">
<a href="http://www.facebook.com.tr">
<img id="socialiconface" src="images/facebook.png">
</a>
<a href="http://www.twitter.com.tr">
<img id="socialicon" src="images/twitter.png">
</a>
</div>
</header>