Text annotation solution for websites. TypeScript and vanilla JavaScript version.

Overview

Simple Text Annotations

Generic badge

Use this small library when you need to add annotations to your website.

Features

  • show up / hide annotation on a element click
  • dynamically inserted texts

Screenshot

Demo example

Demo

Go to Demo page.

Installation

  • Add annotations.js or annotations.ts code to your website.
  • Add styles from annotations.css.
  • Place markup at the bottom of your html file, before closing body tag (it uses fixed positioning).
  <div class="annotation-wrapper">
    <button type="button" class="annotation-close-btn" aria-label="close annotation"></button>
    <p class="annotation-text" id="annotation-text"></p>
  </div>



Usage

1. JavaScript

  • Place your annotation texts in the annotationTexts object.
  • Name keys as you like.
<script>
  const annotationTexts = {
    text1: "First text example.",
    secondText: "Second example with line break. </br>Annotation launched by Button nr 2 and Button nr 3.",
    anotherOne: "List example. </br><ul style='list-style-type: none;'><li>First list item.</li><li>Second list item.</li><li>Third list item.</li>"
  }
</script>

2. HTML

Add to clickable elements that you want to annotate:

  • .annotation-btn class.
  • data-text="key-name" attribute. Make sure its value matches corresponding key in annotationTexts object.
  • aria-describedby="" attribute with no value.

Example

Check out demo examples in index.html.

Changelog

Generic badge - 2021-03-16

Changed

  • New JavaScript and TypeScript logic
  • Id and data-opener attribute removed from the markup

Generic badge - 2021-03-09

Added

  • TypeScript version

Generic badge - 2021-03-01

Added

  • IIFE
  • "use strict"

Generic badge - 2021-02-17

Changed

Custom properties names to

--annotation-color-main
--annotation-color-text



Browser Support

Desktop:   Chrome 38+ ✓   Firefox 25+ ✓   Safari 8+ ✓   Opera 25+ ✓   Edge 12+ ✓   IE 11+ ✓  

Mobile:   Chrome Android 38+ ✓   Firefox Android 25+ ✓   iOS Safari 8+ ✓   Opera Android 25+ ✓  

License

This project is available under the MIT license.

Contact

Jacek Jarczok

You might also like...

A lightweight vanilla JavaScript app for expanding and collapsing blocks of text.

A lightweight vanilla JavaScript app for expanding and collapsing blocks of text.

Read more button A lightweight vanilla javascript read more button for expanding and collapsing blocks of text. Features Choose how many text to keep

May 11, 2022

The Remix version of the fakebooks app demonstrated on https://remix.run. Check out the CRA version: https://github.com/kentcdodds/fakebooks-cra

Remix Fakebooks App This is a (very) simple implementation of the fakebooks mock app demonstrated on remix.run. There is no database, but there is an

Dec 22, 2022

A very simple JavaScript library written in vanilla js for scrambling text.

A very simple JavaScript library written in vanilla js for scrambling text.

Scrambling Text A very simple JavaScript library written in vanilla js for scrambling text. Demo Page Table of Contents Installation Examples Basic Ex

Dec 7, 2022

Obsidian plugin: Type text shortcuts that expand into javascript generated text.

Obsidian plugin: Type text shortcuts that expand into javascript generated text.

Obsidian Plugin - Text Expander JS (open beta) This Obsidian plugin allows the user to type text shortcuts that are replaced by (or "expanded into") j

Dec 27, 2022

A lightweight JavaScript library that renders text in a brilliant style by displaying strings of random characters before the actual text.

A lightweight JavaScript library that renders text in a brilliant style by displaying strings of random characters before the actual text.

cryptoWriter.js A lightweight javascript library which creates brilliant text animation by rendering strings of random characters before the actual te

Sep 13, 2022

Easiest 1-click way to install and use Stable Diffusion on your own computer. Provides a browser UI for generating images from text prompts and images. Just enter your text prompt, and see the generated image.

Easiest 1-click way to install and use Stable Diffusion on your own computer. Provides a browser UI for generating images from text prompts and images. Just enter your text prompt, and see the generated image.

Stable Diffusion UI Easiest way to install and use Stable Diffusion on your own computer. No dependencies or technical knowledge required. 1-click ins

Dec 30, 2022

This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js

This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js. But in most cases, I would recommend you to use something like Express in a production project for productivity purposes.

Jul 19, 2022

Variant types in Roblox TypeScript - Ported from Vanilla TypeScript

Variant types in Roblox TypeScript - Ported from Vanilla TypeScript

Variant (for Roblox) This is a roblox typescript variant (heh, pun) of Variant. See the Variant documentation on how to use Variant. A variant type is

Jun 3, 2022
Owner
Jacek Jarczok
Frontend Developer & UI Designer
Jacek Jarczok
Annotation tools for the web. Select text, images, or (nearly) anything else, and add your notes.

Annotator Annotator is a JavaScript library for building annotation applications in browsers. It provides a set of interoperable tools for annotating

Open Annotation 2.6k Dec 23, 2022
Interactive Text Annotation for Jupyter Notebook/Lab

Interactive Text Annotation for Jupyter Notebook/Lab Perform entity extraction inline without leaving your notebook. Iteratively label and train a mod

null 8 Dec 26, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A web component that allows you to run high level programming languages on your websites (static websites included!)

Code-Runner-Web-Component A web component that allows you to run high level programming languages on your website via the public Piston API Show your

Marketing Pipeline 28 Dec 16, 2022
Uniform, Unlimited, Universal and Unbelievable Annotation Toolbox

特性 ?? 本项目包含@label-u/annotation、@label-u/components、@label-u/utils及@label-u/web等4个工程。 ?? 采用rollup esbuild插件及vite编译,让开发者上高速,开发效率更高 ?? 采用lerna进行多工程管理。 ??

OpenDataLab 16 Dec 23, 2022
A GitHub action to run Dart analyzer with annotation support.

⚒️ GitHub Action for Dart Analyzer A GitHub action to run Dart analyzer with annotation support. License Usage name: "analyze" on: # rebuild any PRs a

Invertase 149 Dec 28, 2022
Omnivore - a complete, open source read-it-later solution for people who like text

Omnivore Omnivore is a complete, open source read-it-later solution for people who like text. We built Omnivore because we love reading and we want it

Omnivore 597 Jan 1, 2023
A small, lightweight JavaScript plugin for placing items in straight rows (jQuery and vanilla JS version) – Demo:

rowGrid.js rowGrid.js is a small, lightweight (~1000 bytes gzipped) jQuery plugin for placing images (or other items) in straight rows. The grid is si

Bruno Joseph 669 Jul 22, 2022
Vanilla JavaScript version of jquery-hoverIntent

sv-hover-intent sv-hover-intent is a JavaScript plugin for handling mouse hovers on a delay. It tracks when the mouse movement has slowed enough that

Scott 6 Mar 18, 2022