I would like to be able to read the value of a CSS property in the middle of a transition before it is fully executed. Is that possible? So if during a transition from 0% to
Is it possible to get the current css property during a transition in JavaScript?
var timer;
function test(e) {
var $this;
$this = $(this);
timer = setInterval(function () {
console.log($this.height());
}, 500);
}
function untest(e) {
clearInterval(timer);
}
$('div').mouseenter(test).mouseleave(untest);
div
{
transition: height 10s;
-moz-transition: height 10s;
-webkit-transition: height 10s;
width: 100px;
height: 100px;
background-color: #00F;
}
div:hover
{
height: 300px;
}
So far I've only tested firefox & chrome, but it appears that you can get the current CSS height via JS.
I can't think of a reason why the browser wouldn't report the change in styles to the DOM during a CSS transition.