typeface.js
User / Developer Forum
Is there a way to apply typeface dynamically via javascript?
marc
|
11 Feb 2010 7:20
I'm using typeface in my php-generated pages, but as far as I understand can't use it if I change the text dynamically via javascript.  I would like to take a div or a paragraph or whatever, change the text, and then apply typeface.  Is there a way to do this?

m
Saff
|
23 Mar 2010 19:49
Yes, but need to call _typeface_js.initialize(); to redraw div's (even if they dynamicly loaded).
It works fine for Safari|IE|Opera(not shure need to test), but there is a bug in firefox with redrawing.
You need to wait for some time(i set 1 sec) before reinitial ))) I don't know why(maybe because i load content dynamicly), but it works ))) Little example:

var t = null;

$(document).ready(function(){
  $('#low_top_12').load('/shop/show_top/',function(d){t=setTimeout("redraw()",1000);});

});

function redraw()
{
_typeface_js.initialize();
clearTimeout(t);
}

Regards, djsaff [@] gmail [dot] com
Brett
|
10 May 2010 17:56
Try this instead:

        _typeface_js.renderDocument();

Does the same thing quicker; fewer redundant calls.
Post a Reply
YOUR NAME
YOUR COMMENT
We don't support HTML, but please use [quote] ... [/quote] tags around quotes.