Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/willdurand/anchorify.js
A dead simple JavaScript library for automatically creating anchored headings in your HTML documents.
https://github.com/willdurand/anchorify.js
Last synced: about 2 months ago
JSON representation
A dead simple JavaScript library for automatically creating anchored headings in your HTML documents.
- Host: GitHub
- URL: https://github.com/willdurand/anchorify.js
- Owner: willdurand
- License: mit
- Archived: true
- Created: 2013-05-10T09:45:31.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-05-16T08:21:54.000Z (over 10 years ago)
- Last Synced: 2024-07-26T03:32:07.083Z (about 2 months ago)
- Language: JavaScript
- Homepage: http://plugins.jquery.com/anchorify/
- Size: 299 KB
- Stars: 116
- Watchers: 11
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Anchorify.js
============[![Build Status](https://travis-ci.org/willdurand/anchorify.js.png?branch=master)](https://travis-ci.org/willdurand/anchorify.js)
Anchorify.js is a dead simple JavaScript library for automatically creating
anchored headings in your HTML documents. It guarantees uniqueness of the anchor
names, and is able to reuse existing ids.It can be used either as a jQuery plugin, or as a standalone library without any
dependencies (except `querySelectorAll()`).Usage
-----It could not be easier as Anchorify.js provides a jQuery plugin out of the box:
``` javascript
$('h2 h3').anchorify();
```Anchorify.js generates clean anchor names:
``` html
Hello, World!
Hello, World!¶
```By default, it uses the `¶` sign for the links' text, and adds an `anchor-link`
CSS class on each link.However, you can configure your own text, CSS class and anchor position using
the `text`, `cssClass` and `position` options:``` javascript
$('h2').anchorify({ text: 'Hey', cssClass: 'anchor', position: 'prepend' });
`````` html
HeyHello, World!
```Running the Tests
-----------------Open the `tests/index.html` file in your browser or use
[PhantomJS](http://phantomjs.org/):phantomjs tests/run-qunit.js file:///.../anchorify.js/tests/index.html
License
-------Anchorify.js is released under the MIT License. See the bundled LICENSE file for
details.