如何将滚动中的文本添加到已经有图标的顶部按钮 [英] How can I add text in my scroll to top button which already has an icon in it
问题描述
我对这个领域完全陌生,所以请帮帮我.
I'm totally new to this field so please help me out.
我几乎尝试了所有方法,但似乎没有任何效果.实际上,我想在我的滚动到顶部按钮中添加一些文本,该按钮已经制作完成并且运行良好,并且其中有一个图标.但我想用那个图标添加一些文字.这是一个链接我想要做什么!
I've tried almost everything but nothing seems to be working. Actually, I want to add some text in my scroll to top button, which has already been made and working perfectly and it has an icon in it. But I want to add some text with that icon. Here's a link what I want to do!
以下是我在js文件中的代码:
Following is the code I have in js file:
// Append Button
$("body").append($("<a />")
.addClass("scroll-to-top")
.attr({
"href": "#",
"id": "scrollToTop"
})
.append(
$("<i />")
.addClass("icon icon-chevron-up icon-white")
));
我应该在哪里添加文本,无论是在上面的代码文件中还是在我的页面代码中?
where should I have to add the text, either in the above code file or into the code of my page?
任何形式的帮助将不胜感激.
Help of any kind would be appreciated.
提前致谢.
推荐答案
请尝试以下操作.
$("body").append($("<a />")
.addClass("scroll-to-top")
.attr({
"href": "#",
"id": "scrollToTop"
})
.append(
$("<i>Scroll</i>")
.addClass("icon icon-chevron-up icon-white")
));
这篇关于如何将滚动中的文本添加到已经有图标的顶部按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!