javascript - 将 github javascript 库 (underline.js) 添加到我的项目中
问题描述
我想在我的文本下划线,因此在我的网页中添加来自 github 的 javascript 库。我知道还有其他选项可以给文本加下划线,但我想使用该库的这个漂亮的下划线。另外,忽略下划线问题,我只想知道如何使用这样的 github 项目。我想添加这个库:https ://github.com/wentin/underlineJS
我之前已经添加了库,但总是提供了一个 npm 安装注释,或者 .jar 文件位于您可以使用的 github 主文件夹中(在 Java 中,而不是 Javascript)
通过查看 github 项目中的代码,我想我至少必须将这个脚本链接添加到我的标题中:
<link type="text/css" rel="stylesheet" href="css/underline.css" />
然后将其添加到我的 CSS 中:
.underline {
position: relative;
}
.underline span {
pointer-events: none;
}
.underline canvas {
pointer-events: auto;
position: absolute;
top: 0;
left: 0;
/*background-color: rgba(222, 222, 222, 0.1);*/
/*z-index: -1;*/
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-o-user-select: none;
cursor: pointer;
}
最后在我的 HTML 中使用它:
<a href="#" class="underline">at your gate</a>
<br>
<br>
但这完全没有效果......
解决方案
你不能轻易添加这个库,因为它只是一个技术演示。
引用:
尽管名字很吸引人,Underline.js 只是一个技术演示。这意味着如果不先对其进行大量修改,您将无法将其放入任何项目中。
来源:https ://css-tricks.com/styling-underlines-web/#underline-js-canvas
推荐阅读
- python - ax.twinx().twiny() 右侧 y 轴的刻度和标签不可移除
- shell - 从 shell 脚本中的键值对为变量赋值
- amazon-redshift - Redshift 中的 LAG 窗口函数 - 在单行中显示上一年和当前年份的值
- python - Python Pandas:“loc”和“iloc”代表什么?
- php - 检查,在 PHP 中;如果连接的动态 mySQL 数据库发生了变化?
- python - 如何在 O(log n) 时间内遍历这棵二叉树?
- typescript - 类型提示扩展抽象类
- html - CSS旋转动画上的像素跳跃
- javascript - Jquery在模式弹出之前检查是否需要表单字段
- netlogo - 如何计算模型中海龟之间的唯一交互次数?