如何使用annotator.js加载页面加载上的注释对象?

时间:2014-06-07 01:32:25

标签: javascript

我正在尝试在使用annotator.js加载页面时加载注释对象,谁都知道如何?

2 个答案:

答案 0 :(得分:1)

尝试包含

<script src="http://assets.annotateit.org/annotator/v1.2.5/annotator-full.min.js"></script>
<link rel="stylesheet" href="http://assets.annotateit.org/annotator/v1.2.5/annotator.min.css">

之后,您只需要使用Javascript在网页的所需部分上执行注释器功能。就像这样:

jQuery(function ($) {
    $('#my-div-that-should-be-annotated').annotator();
});

答案 1 :(得分:1)

我不确定你是如何存储注释的,但是如果你已经有了注释,这就是你加载它们的方法。

所以在页面加载后,添加:

var ann = $(element).annotator();  
ann.annotator("loadAnnotations", comments);  

其中comments是注释对象的数组,定义如下: http://docs.annotatorjs.org/en/stable/annotation-format.html