STRML / textFit

A jQuery-free component that quickly fits single and multi-line text to the width (and optionally height) of its container.
https://textfit.strml.net
643 stars 122 forks source link

Text from input box only appearing on single line #55

Closed Overbord closed 3 years ago

Overbord commented 3 years ago

This is how I'm trying to implement things:

    jQuery("#form-field-text").on("change keyup paste", function(){
        jQuery('.canvas-text').text(jQuery(this).val());
        textFit(jQuery(".canvas-text"), {widthOnly: false});
    });

So a user fills text in the input box at #form-field-text, it automatically gets inserted into .canvas-text at every keypress, and after that textFit runs. It's doing its job, but the text is only appearing on a single line. Check out the codepen here:

https://codepen.io/overbord/pen/rNGNNjx

Overbord commented 3 years ago

Nevermind, solved it with multiline: true