http://jasperalani.com/
If you hover over the logo at the bottom left of the page it becomes super pixelated when you hover over it.
I am using
transform: rotate(360deg);
How can I fix this so it maintains its quality?
That's because you are making you image to transform:rotate(360deg);, instead of that target you parent element .socialmedia and try it works.
.socialmedia {
position: fixed;
bottom: 0;
right: 1;
width:21px;
height:21px;
-webkit-transition: -webkit-transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out;
}
img{
width: 100%;
height: 100%;
}
.socialmedia:hover{
transform:rotate(360deg);
}
.socialmedia {
position: fixed;
bottom: 0;
right: 1;
width:21px;
height:21px;
-webkit-transition: -webkit-transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out;
}
img{
width: 100%;
height: 100%;
}
.socialmedia:hover{
transform:rotate(360deg);
}
<div class="socialmedia">
<a href="https://ello.co/jasperalani">
<img id="ello" src="http://jasperalani.com/images/ello_icon.png">
</a>
</div>
This is a known problem on Google Chrome.
Usually, you can overcome the problem by adding -webkit-backface-visibility: hidden to your element you rotate. In your example it will remove the anti aliasing entirely, though.
This is, because you are using transition instead of transform, so to fix the problem you rather add outline: 1px solid transparent to the CSS of your image. This will solve the problem.
img {
width: 21px;
height: 21px;
-webkit-transition: -webkit-transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out;
outline: 1px solid transparent;
}
img:hover {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
<img id="ello" src="http://jasperalani.com/images/ello_icon.png">
Related
I'm trying to achieve a simple :hover effect where the image hovered scales up when hovered. Strangely, when I click the :hover radio button in the "Force element state" in Chrome dev tools, the effect works as expected, but when I actually hover over the image, no dice. Any insight would be much appreciated!
This is my markup (the image has a semi opaque overlay)
<article class="news-loop_item">
<img
src="http://imgsv.imaging.nikon.com/lineup/lens/zoom/normalzoom/af-
s_dx_18-300mmf_35-56g_ed_vr/img/sample/sample4_l.jpg" class="news-
loop_img" alt="featured image">
<div class="news-loop_overlay">
<h2 class="news-loop_title">Title</h2>
<p class="news-loop_date">Date</p>
<div class="news-loop_summary">Summary</div>
</div>
</article>
And my scss
.news-loop {
flex-wrap: wrap;
margin: -1rem;
}
.news-loop_item {
flex-basis: calc(100% / 2 - 2rem);
height: 20rem;
margin: 1rem;
overflow: hidden;
position: relative;
}
.news-loop_img {
height: 100%;
object-fit: cover;
overflow: hidden;
-webkit-transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
-ms-transition: all .3s ease-in-out;
-o-transition: all .3s ease-in-out;
transition: all .3s ease-in-out;
position: relative;
vertical-align: middle;
width: 100%;
}
.news-loop_img:hover {
-webkit-transform: scale(1.15, 1.15);
transform: scale(1.15, 1.15);
}
.news-loop_overlay {
background: rgba(0, 0, 0, .75);
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
-webkit-transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
-ms-transition: all .3s ease-in-out;
-o-transition: all .3s ease-in-out;
transition: all .3s ease-in-out;
}
.news-loop_overlay:hover {
background: rgba(0, 0, 0, .5);
}
https://codepen.io/evanhickman/pen/ZXOmWb
The reason why is that your hover selector is wrong, check out this:
.news-loop_item:hover .news-loop_img {
-webkit-transform: scale(1.15, 1.15);
transform: scale(1.15, 1.15);
}
See the parent element needs the hover event.
The issue is because your .news-loop_overlay class div is 'capturing' the hover effect.
Try adding a z-index: -1; to that div and you'll see that the scale works.
.tidings {
width: 30%;
float: left;
margin: 0 3%;
}
.tidingsimg:before{
content: url("https://s4.postimg.org/466igrsgt/Tidingsrune.png");
position: relative;
transition: opacity 1s ease;
-webkit-transition: opacity 1s ease;
}
.tidingsimg:after{
content: url("https://s12.postimg.org/83p4b0ubx/Tidingsrune2.png");
position:absolute;
top: 0;margin-top: 10px;
opacity:0;
transition: opacity 1s ease;
-webkit-transition: opacity 1s ease;
}
.tidingsimg:hover:after{
opacity:1;
}
.tidingsimg:hover:before{
opacity:0;
}
<div class="tidings"></div>
I have an image that I am trying to have smoothly transition into another image using content: url. It works in changing the images abruptly, however I cannot figure out how to apply the transition to actually make it smoothly transition from one image to another. Is it possible to do this using content?
Here is a JSFiddle showing what I have going on.
You Should use Before after and set opacity and transition on them
In .tidingsimg:after class we add position:absolute and top: 0;margin-top: 10px; Because without it after style will go far below before style
.tidings {
width: 30%;
float: left;
margin: 0 3%;
}
.tidingsimg:before{
content: url("https://s4.postimg.org/466igrsgt/Tidingsrune.png");
position: relative;
transition: opacity 1s ease;
-webkit-transition: opacity 1s ease;
}
.tidingsimg:after{
content: url("https://s12.postimg.org/83p4b0ubx/Tidingsrune2.png");
position:absolute;
top: 0;margin-top: 10px;
opacity:0;
transition: opacity 1s ease;
-webkit-transition: opacity 1s ease;
}
.tidingsimg:hover:after{
opacity:1;
}
.tidingsimg:hover:before{
opacity:0;
}
<div class="tidings"></div>
I'm trying to change a div opacity depending on having the class active or not.
When the div has the active class, I want to change the opacity to 1. If the div does not have the active class, I want to change the opacity to 0.
Follows my CSS code:
.high-light{
position: fixed;
width: 100%;
height: 100%;
top: 0;
background-color: black;
background-color: rgba(0, 0, 0, 0.61);
opacity:0;
left: 0;
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
transition: opacity 3s linear;
}
#multicanvasArea.active .high-light {
opacity:1;
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
transition: opacity 0.5s linear;
}
Thank you
[EDIT]
One of the problems was that I change the css property to "block" and "none". The other was solve by the answer choosen.
When the div has the active class, I want to change the opacity to 1. If the div does not have the active class, I want to change the opacity to 0.
You need to combine the classes like so.
As it was you have .highlight as a child of .active.
.high-light{
position: fixed;
width: 100%;
height: 100%;
top: 0;
background-color: black;
background-color: rgba(0, 0, 0, 0.61);
opacity:0;
left: 0;
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
transition: opacity 3s linear;
}
.high-light.active {
opacity:1;
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
transition: opacity 0.5s linear;
}
The problem here is not the transition, it's the height 100% which is not taking effect because the parent element (body) is not tall 100%.
$('button').on('click', function(e) {
$("#multicanvasArea").toggleClass('active');
})
.high-light{
position: fixed;
width: 100%;
height: 30px;
top: 0;
background-color: black;
opacity:0;
left: 0;
color: white;
transition: opacity 3s linear;
}
#multicanvasArea.active .high-light {
opacity:1;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="multicanvasArea">
<p class="high-light">Highlight</p>
<p class="">Other text</p>
</div>
<button>Toggle class</button>
Your code was 95% there, just a few tweaks I made seem to do the trick. Here is the new css:
#multicanvasArea .high-light{
position: fixed;
width: 100%;
height: 100%;
top: 0;
background-color: black;
background-color: rgba(0, 0, 0, 0.61);
opacity:0;
left: 0;
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
transition: opacity 3s linear;
}
#multicanvasArea.active .high-light {
opacity:1;
}
Here is a link to a pen with a working example:
http://codepen.io/anon/pen/pEjrJo
this is a working example. The Javascript is only to toggle the class.
.box {
width: 200px;
height: 200px;
background: pink;
opacity: 0;
transition: opacity 3s linear;
&.active {
opacity: 1;
}
}
https://plnkr.co/edit/RZRygZieCUMVWiOVEJR8?p=preview
I'm trying to create a hover button using the following code and it works relatively okay in all browsers except Chrome:
<div id="blur" class="et_pb_module et-waypoint et_pb_image et_pb_animation_off et_pb_image_0 et_always_center_on_mobile et-animated">
<a href="http://vina.typesetdesign.com/wines/reserva/reserva-sauvignon-blanc/">
<img alt="" src="http://vina.typesetdesign.com/wp-content/uploads/2015/11/2015_11_17Vina_Echeverria_Reserva_Sauvignon_Blanc_V1.png">
</a>
</div>
#blur img {
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
#blur img:hover {
opacity: .4;
z-index: 1;
}
#blur a:hover:before {
background-color: #6d8e3b;
color: #fff;
content: "Learn More";
display: block;
font-size: 12px;
margin-left: auto;
margin-right: auto;
opacity: .9 !important;
padding: 18px;
position: relative;
top: 20em;
width: 70px;
z-index: 2;
margin-top: -3em;
}
For some reason, Chrome won't let you hover over the button without it glitching out and flickering super badly. Is there an easy way around this without having to add in a separate button?
Live Page: http://vina.typesetdesign.com/wines/varietal/
Fiddle: https://jsfiddle.net/35txpy8v/
It's flickering because the element moves while you hover over it. The reason the element is moving is because of the pseudo element's positioning. To work around this, I'd suggest absolutely positioning the pseudo element relative to the parent element. In doing so, the pseudo element's position won't have any effect on the parent element.
Updated Example
#blur img {
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
position: relative;
}
#blur img:hover {
opacity: .4;
z-index: 1;
}
#blur a:hover:before {
content: "Learn More";
background-color: #6d8e3b;
position: absolute;
top: 50%;
margin-top: -50px;
color: #fff;
font-size: 12px;
opacity: .9;
padding: 18px;
width: 70px;
z-index: 2;
}
I'm looking for css magic here. I want the user to hover over the box which already has the text on it. Then I need the black box to rise up from below and sit behind the text.
MY JS FIDDLE HERE!
I've got this:
<div class="box expanded">
Some text
</div>
My CSS:
.expanded {
height: 179px;
font-size: 20px;
padding-top: 130px;
position: relative;
z-index: 1000;
background-color: red;
transition: transform 0.4s;
}
.expanded:after {
content: '';
position: absolute;
height: 80px;
width: 100%;
bottom: 0;
left: 0;
z-index: -999;
background-color: #000;
transform: translateY(0%);
transition: transform 0.4s, opacity 0.1s 0.3s;
}
Add overflow:hidden to the parent, .box, and set the initial position of the pseudo element to top:100%. On :hover of the pseudo element, transition it to top:0 and add some transition properties to make it smooth.
UPDATED EXAMPLE HERE
.box {
overflow:hidden;
}
.expanded:after {
content:'';
position: absolute;
height: 80px;
width: 100%;
top:100%;
left:0;
z-index: -999;
background-color: #000;
transition: all 1s;
-webkit-transition: all 1s;
-moz-transition: all 1s;
}
.expanded:hover:after {
top:0;
}
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;
-o-transition: all 0.4s ease-out;
transition: all 0.4s ease-out;
Put this in .expanded class