Socket
Socket
Sign inDemoInstall

anchorific

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.1.2

4

package.json
{
"name": "anchorific",
"version": "0.1.1",
"version": "0.1.2",
"description": "Automatically generate anchored headings and nested navigations based on header tags",

@@ -22,3 +22,3 @@ "main": "anchorific.js",

],
"author": "Ren Aysha",
"author": "renettarenula <ren.aysha@gmail.com>",
"license": "MIT ",

@@ -25,0 +25,0 @@ "bugs": {

@@ -6,3 +6,20 @@ # Anchorific.js

## Installation
Via NPM
```
npm install --save anchorific
```
For a guide on how to using jQuery plugins with npm, check out: https://blog.npmjs.org/post/112064849860/using-jquery-plugins-with-npm
Via CDN
```
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchorific/1.2/min/anchorific.min.js"></script>
```
## Getting Started
### HTML Structure

@@ -12,11 +29,11 @@

``` html
```html
<h1>The Lannisters</h1>
<h2>Tywin Lanister</h2>
<h2>Cersei Lannister</h2>
<h3>Joffrey Baratheon</h3>
<h3>Myrcella Baratheon</h3>
<h3>Tommen Baratheon</h3>
<h2>Jaime Lannister</h2>
<h2>Tyrion Lannister</h2>
<h2>Tywin Lanister</h2>
<h2>Cersei Lannister</h2>
<h3>Joffrey Baratheon</h3>
<h3>Myrcella Baratheon</h3>
<h3>Tommen Baratheon</h3>
<h2>Jaime Lannister</h2>
<h2>Tyrion Lannister</h2>
```

@@ -26,18 +43,24 @@

``` html
```html
<ul>
<li data-tag="1"><a href="#the-lannisters">The Lannisters</a>
<li data-tag="1">
<a href="#the-lannisters">The Lannisters</a>
<ul>
<li data-tag="2"><a href="#tywin-lannister">Tywin Lannister</a></li>
<li data-tag="2">
<a href="#cersei-lannister">Cersei Lannister</a>
<ul>
<li data-tag="2"><a href="#tywin-lannister">Tywin Lannister</a></li>
<li data-tag="2"><a href="#cersei-lannister">Cersei Lannister</a>
<ul>
<li data-tag="3"><a href="#joffrey-baratheon">Joffrey Baratheon</a></li>
<li data-tag="3"><a href="#myrcella-baratheon">Myrcella Baratheon</a></li>
<li data-tag="3"><a href="#tommen-baratheon">Tommen Baratheon</a></li>
</ul>
</li>
<li data-tag="2"><a href="#jaime-lannister">Jaime Lannister</a></li>
<li data-tag="2"><a href="#tyrion-lannister">Tyrion Lannister</a></li>
<li data-tag="3">
<a href="#joffrey-baratheon">Joffrey Baratheon</a>
</li>
<li data-tag="3">
<a href="#myrcella-baratheon">Myrcella Baratheon</a>
</li>
<li data-tag="3"><a href="#tommen-baratheon">Tommen Baratheon</a></li>
</ul>
</li>
</li>
<li data-tag="2"><a href="#jaime-lannister">Jaime Lannister</a></li>
<li data-tag="2"><a href="#tyrion-lannister">Tyrion Lannister</a></li>
</ul>
</li>
</ul>

@@ -48,6 +71,8 @@ ```

``` html
```html
<h1>Tywin Lannister</h1>
<!-- This would be turn to -->
<h1 id="tywin-lannister">Tywin Lannister <a href="#tywin-lannister" class="anchor">#</a></h1>
<h1 id="tywin-lannister">
Tywin Lannister <a href="#tywin-lannister" class="anchor">#</a>
</h1>
```

@@ -59,6 +84,10 @@

``` html
```html
<h3 id="what-if-I-already-have-an-id">What about existing ID?</h3>
<!-- This would be turn to -->
<h3 id="what-if-I-already-have-an-id">What about existing ID?<a href="#what-if-I-already-have-an-id" class="anchor">#</a></h3>
<h3 id="what-if-I-already-have-an-id">
What about existing ID?<a href="#what-if-I-already-have-an-id" class="anchor"
>#</a
>
</h3>
```

@@ -70,4 +99,4 @@

``` html
<nav class='anchorific'></nav>
```html
<nav class="anchorific"></nav>
```

@@ -81,10 +110,16 @@

``` css
.anchorific {}
.anchorific ul {}
.anchorific ul li a {}
.anchorific li ul {}
```css
.anchorific {
}
.anchorific ul {
}
.anchorific ul li a {
}
.anchorific li ul {
}
/* active class is generated by the scrollspy */
.anchorific li.active > a {}
.anchorific li.active > ul {}
.anchorific li.active > a {
}
.anchorific li.active > ul {
}
```

@@ -98,4 +133,4 @@

``` javascript
$('.content').anchorific();
```javascript
$(".content").anchorific();
```

@@ -105,14 +140,13 @@

``` javascript
$('.content').anchorific({
navigation: '.anchorific', // position of navigation
headers: 'h1, h2, h3, h4, h5, h6', // headers that you wish to target
speed: 200, // speed of sliding back to top
anchorClass: 'anchor', // class of anchor links
anchorText: '#', // prepended or appended to anchor headings
top: '.top', // back to top button or link class
spy: true, // scroll spy
position: 'append', // position of anchor text
spyOffset: 0 // specify heading offset for spy scrolling
```javascript
$(".content").anchorific({
navigation: ".anchorific", // position of navigation
headers: "h1, h2, h3, h4, h5, h6", // headers that you wish to target
speed: 200, // speed of sliding back to top
anchorClass: "anchor", // class of anchor links
anchorText: "#", // prepended or appended to anchor headings
top: ".top", // back to top button or link class
spy: true, // scroll spy
position: "append", // position of anchor text
spyOffset: 0, // specify heading offset for spy scrolling
});

@@ -127,3 +161,3 @@ ```

``` html
```html
<a href="#top" class="top">Scroll to top</a>

@@ -144,3 +178,3 @@ ```

``` bash
```bash
$ npm install

@@ -151,3 +185,3 @@ ```

``` bash
```bash
$ grunt

@@ -154,0 +188,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc