Closed mrdziuban closed 9 years ago
Try this:- http://jsfiddle.net/rr6Lq86z/1/
(function() {
var element = document.getElementById('ellipsis');
element.style.height = (window.innerHeight/4)+'px';
var ellipsis = new Ellipsis(element);
ellipsis.calc();
ellipsis.set();
window.onresize = function() {
ellipsis.unset(); // <- added this
element.style.height = (window.innerHeight/4)+'px';
ellipsis.calc();
ellipsis.set();
};
})();
[ Also, thanks for the really nice reduced test case—it's always really helpful when people provide this ]
That worked perfectly, thank you! And thanks for the pure JS plugin, it's nice to find ones that don't depend on jQuery.
I have an element with a height that is getting changed dynamically when the window is resized. When the window gets shorter, the element gets shorter and the line clamp on the child elements goes down properly. When the window gets taller, however, the element gets taller but the line clamp does not go up. Here's a jsfiddle example.
Is there a way I can fix this with my code?