仅在某些 html 元素中启用注释器 JS V2



我正在尝试仅在某些html元素中启用Annotator Js V2.0,而不是整个文档,但没有成功。 该文档介绍了参数可以作为选项传递以定义:

事件侦听器绑定到的 DOM 元素。默认为 document.body,允许对整个文档进行注释。

下面是文档中引用的代码:

var app = new annotator.App();
app.include(annotator.ui.main, {element: document.body});
app.start();

我正在尝试通过类名定义另一个 html 元素,例如:

var app = new annotator.App();
app.include(annotator.ui.main, {element: '.class-name'});
app.start();

不过这是行不通的。您能就适当的方法提出建议吗?

我知道它非常晚,但希望可以帮助某人。 :)请使用如下所示的document.querySelector

元素:document.querySelector('.class-name')

最新更新