hi all, i have the following question: for example: a customer wrote his adress, switched the typeface + see it directly in a "preview"! how can i do that?

is it possible to do something like "change text on the fly" with jquery or something like this? we are signmaker in germany + i am searching for such an tool.

thanks for help ... ralf

  • Is it something like the preview when you edit question or answer on this site + ability to change font typeface? o.k.w over 8 years ago

1 answer

danwellman 5600

You could define a whole bunch of different classes, each on with a different typeface, e.g.

.times { font-family: "Times new Roman"; }
.verdana { font-family: Verdana; }

etc...Have a different class for each typeface. If you wanted you could also use a lot of new fonts and use @font-face to show the fonts, you;d just need to ensure viewers were using a modern browser (maybe use modernizr to display a message if their browser is too old)

Then you could have a select box listing all of the different fonts and use the change event of the select box to apply the new class to a preview paragraph, something like this:

$("#select_id").change(function() {

    //remove existing class(es)
    $("#preview_p_id").attr("class", "");

    //add selected class


Something like that ought to do it :)

Answered over 8 years ago by danwellman