Load external font with javascript and jquery -


I have a & lt; P & gt; Element is dynamically created with jquery, and I want to make it style with a custom font on my hard drive.

Can you follow a method to load that font and apply it to this element.

Right now, the object looks something like this:

  $ ("& lt; p & gt;"). CSS ({fontFamily: "Arial", fontSize: "13px", color: "# 000"});  

This piece of code does all the work:

  $ ("head"). Prepaid ("& style; type = \" \ "post-text \" itemprop = "text" text / css \ "& gt; @ font-face {\ n" + "\ tfont-family: \" myFont \ "; \ N" + "\ tsrc: local ('a ?? ยบ'), url ('myFont.otf') format ('opentepe'); \ n" + "} \ n" + "\ tp. MyClass {\ n "+" \ tfont-family: myFont! Important; \ n "+"} \ N "+" & lt; / style & gt; ");    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -