css-element-queries icon indicating copy to clipboard operation
css-element-queries copied to clipboard

Problems with CSS transitions

Open jscontrust opened this issue 9 years ago • 2 comments
trafficstars

When there is a transition on the width of the element or on a parent element, the right styles are not always applied.

div.whatever { width: 500px; transition: width 0.5s; }

@media screen and (max-width: 400px) { width: 200px; }

div.whatever[max-width: 300px] { background-color: red; }

div.whatever never becomes a red background.

Is this library still under development?

jscontrust avatar Dec 07 '15 13:12 jscontrust

Ok, another info: I had the same problems with a bootstrap column with different size for different screen sizes:

<div class='row'>
    <div class='col-sm-8 col-md-5'>
    </div>
</div>

I helped myself with:

$( window ).resize(function() {
    // On resize finish
    clearTimeout($.data(this, 'resizeTimer'));
    $.data(this, 'resizeTimer', setTimeout(function() {
        window.ElementQueries.update();
    }, 500));
});

jscontrust avatar Dec 07 '15 13:12 jscontrust

The newest version has a transition fix in it. Could you please try this version and say us if you keep having issues with it?

marcj avatar Feb 01 '16 09:02 marcj