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
Post a Comment