简体   繁体   English

使用jQuery更改字体系列

[英]Change font-family using jQuery

I want to change the font-family of a string embedded inside a function of jQuery. 我想更改嵌入在jQuery函数中的字符串的font-family I have tried every means without luck. 我已经尝试了所有没有运气的方法。 Please help me. 请帮我。 Here is the code: 这是代码:

$(function() {
  $(".element").typed({
    strings: ["Web/Graphic Designer"],
    typeSpeed: 70,
    showCursor: false,
  });
});

The font-family: 'HelveticaLTStd-Roman' but I can't change it to my preferred font. font-family: 'HelveticaLTStd-Roman'但我无法将其更改为首选字体。 All help will be appreciated. 所有帮助将不胜感激。 Thanks. 谢谢。

You can do something like this. 你可以做这样的事情。 Adding .css() for adding the specific font on your selected elements. 添加.css()以便在所选元素上添加特定字体。

$(function() {
  $(".element").typed({
    strings: ["Web/Graphic Designer"],
    typeSpeed: 70,
    showCursor: false,
  }).css("font-family", "HelveticaLTStd-Roman");
});

Here is jQuery's offical documentation on .css http://api.jquery.com/css/ 这是jQuery在.css上的官方文档http://api.jquery.com/css/

Don't forget to include the font to your project. 不要忘记在项目中包含字体。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM