[英]Appending a Font-Awesome icon to an H1 element using JQuery
I am trying to dynamically append an FA icon to an <h1>
tag using JQuery. 我正在尝试使用JQuery将FA图标动态附加到
<h1>
标记。 The icon does get appended; 图标确实被附加; however, it doesn't render on display.
但是,它不会显示。 My JQuery snippet is a ridiculously simple and straightforward one:
我的JQuery代码段是一个非常简单明了的代码:
function pronounce() {
$('h1.source-text').append('<i class="icon-volume-up pronounce"></i>');
};
The above function is called once a certain condition (as outlined in another script) checks out. 一旦确定了某个条件(如另一个脚本中概述),就会调用上述函数。 The script is not wrong because I can see the appended FA icon in my Web Inspector:
该脚本没有错,因为我可以在Web Inspector中看到附加的FA图标:
What could be going on here? 这可能是怎么回事?
FontsAwesome uses the following syntax: FontsAwesome使用以下语法:
<i class="fa fa-volume-up"></i>
Source: http://fortawesome.github.io/Font-Awesome/icon/volume-up/ 资料来源: http : //fortawesome.github.io/Font-Awesome/icon/volume-up/
If you're using this font-awesome I think the class for the <i>
should be fa fa-volume-up
so your entire <i>
will become: 如果您使用的是超棒的字体,我认为
<i>
的类应该是fa fa-volume-up
所以整个<i>
都将变为:
<i class="fa fa-volume-up"></i>
Find all the classes and icons here 在此处找到所有课程和图标
Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.