Webkit text flickers when using CSS transform (scale)
Date : March 29 2020, 07:55 AM
help you fix your problem I'm facing the same problem: I want to scale an element on hover, and when doing so every text on the page flickers. I'm also on latest Chrome (21.0.1180.89) and OSX Mountain Lion. Actually, adding -webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
|
jQuery draggable and -webkit-transform: scale();
Date : March 29 2020, 07:55 AM
wish of those help Due to my small amount of experience with JavaScript I didn't realise that the callback could in fact modify the position, even though it doesn't return anything. This is because in JS apparently parameters are by default passed by reference. Here's a working code: // Couldn't figure out a way to use the coordinates
// that jQuery also stores, so let's record our own.
var click = {
x: 0,
y: 0
};
$('.draggable').draggable({
start: function(event) {
click.x = event.clientX;
click.y = event.clientY;
},
drag: function(event, ui) {
// This is the parameter for scale()
var zoom = 1.5;
var original = ui.originalPosition;
// jQuery will simply use the same object we alter here
ui.position = {
left: (event.clientX - click.x + original.left) / zoom,
top: (event.clientY - click.y + original.top ) / zoom
};
}
});
|
-webkit-transform: scale breaks down when zoomed in on iOS
Date : March 29 2020, 07:55 AM
it helps some times Here's the result of my extensive investigation before I gave up. There are two major problems involved in applying transform: scale to content inside iframes on iOS. The first was what I pointed out in the original question, that content starts to drift away from it's specified location on the page if you are using fixed position elements. It works up to a point that seems to be based on the original size of the element, the scale factor, and presumably the viewport width. In my tests a large element might scale and position perfectly when scaled at any factor greater than 0.85. A small element might be positioned perfectly so long as the scale factor is at least >3.5. It seems almost random, so I didn't bother determining what the exact point was. container.css('top', (document.body.scrollTop + window.innerHeight - container.height()) + 'px');
container.css('left', document.body.scrollLeft);
|
Safari won't -webkit-transform: scale()
Date : November 21 2020, 07:38 AM
may help you . Somehow I got this fixed, and I have no idea how. -webkit- will always remain a mystery...
|
Transform doesnt animate when added class with transform: scale(1) via Jquery
Date : March 29 2020, 07:55 AM
around this issue You need to break up the adding the div and adding a class to it, e.g. using a setTimeout(). W/o the above, the animation won't apply the transition, as it does all in one go. $("button").click(event => {
let div = $("<div></div>");
div.insertAfter("button");
setTimeout(function() {
div.addClass("animate");
}, 10)
});
div{
height: 50px;
width: 50px;
background: #000;
transform: scale(0);
transition: transform 1s;
}
.animate{
transform: scale(1);
}
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<button>Button</button>
$("button").click(event => {
let div = $("<div></div>");
div.insertAfter("button");
div.addClass("animate");
});
div{
height: 50px;
width: 50px;
background: #000;
transform: scale(0);
}
.animate{
animation: scale 1s forwards;
}
@keyframes scale {
from { transform: scale(0); }
to { transform: scale(1); }
}
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<button>Button</button>
|