jekyll-theme-primer 0.5.1 β 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE.md +1 -1
- data/README.md +39 -13
- data/_includes/head-custom-google-analytics.html +10 -0
- data/_includes/head-custom.html +9 -0
- data/_layouts/default.html +7 -5
- data/_layouts/home.html +4 -0
- data/_layouts/page.html +4 -0
- data/_layouts/post.html +4 -0
- data/_sass/primer-base/lib/base.scss +17 -0
- data/_sass/primer-base/lib/normalize.scss +2 -4
- data/_sass/primer-layout/lib/grid-offset.scss +12 -23
- data/_sass/primer-markdown/lib/code.scss +3 -16
- data/_sass/primer-markdown/lib/lists.scss +5 -1
- data/_sass/primer-markdown/lib/markdown-body.scss +1 -1
- data/_sass/primer-support/lib/mixins/buttons.scss +13 -9
- data/_sass/primer-support/lib/mixins/layout.scss +18 -12
- data/_sass/primer-support/lib/variables/layout.scss +15 -1
- data/_sass/primer-support/lib/variables/misc.scss +1 -1
- data/_sass/primer-utilities/index.scss +1 -0
- data/_sass/primer-utilities/lib/animations.scss +33 -2
- data/_sass/primer-utilities/lib/borders.scss +75 -38
- data/_sass/primer-utilities/lib/details.scss +18 -0
- data/_sass/primer-utilities/lib/flexbox.scss +45 -73
- data/_sass/primer-utilities/lib/layout.scss +16 -27
- data/_sass/primer-utilities/lib/margin.scss +42 -75
- data/_sass/primer-utilities/lib/padding.scss +26 -56
- data/_sass/primer-utilities/lib/typography.scss +22 -23
- data/_sass/primer-utilities/lib/visibility-display.scss +21 -45
- data/_sass/primer.scss +4 -0
- metadata +71 -72
- data/_sass/primer-base/LICENSE +0 -21
- data/_sass/primer-base/README.md +0 -48
- data/_sass/primer-base/build/build.css +0 -1
- data/_sass/primer-base/build/index.js +0 -1
- data/_sass/primer-base/package.json +0 -68
- data/_sass/primer-layout/LICENSE +0 -21
- data/_sass/primer-layout/README.md +0 -137
- data/_sass/primer-layout/build/build.css +0 -1
- data/_sass/primer-layout/build/index.js +0 -1
- data/_sass/primer-layout/package.json +0 -65
- data/_sass/primer-markdown/LICENSE +0 -21
- data/_sass/primer-markdown/README.md +0 -218
- data/_sass/primer-markdown/build/build.css +0 -1
- data/_sass/primer-markdown/build/index.js +0 -1
- data/_sass/primer-markdown/package.json +0 -69
- data/_sass/primer-support/LICENSE +0 -21
- data/_sass/primer-support/README.md +0 -42
- data/_sass/primer-support/package.json +0 -66
- data/_sass/primer-utilities/LICENSE +0 -21
- data/_sass/primer-utilities/README.md +0 -48
- data/_sass/primer-utilities/build/build.css +0 -1
- data/_sass/primer-utilities/build/index.js +0 -1
- data/_sass/primer-utilities/package.json +0 -65
- data/assets/javascript/anchor-js/.eslintrc +0 -77
- data/assets/javascript/anchor-js/.gitattributes +0 -2
- data/assets/javascript/anchor-js/.npmignore +0 -4
- data/assets/javascript/anchor-js/.travis.yml +0 -6
- data/assets/javascript/anchor-js/anchor.js +0 -334
- data/assets/javascript/anchor-js/anchor.min.js +0 -6
- data/assets/javascript/anchor-js/banner.js +0 -17
- data/assets/javascript/anchor-js/docs/anchor.js +0 -334
- data/assets/javascript/anchor-js/docs/favicon.ico +0 -0
- data/assets/javascript/anchor-js/docs/fonts/anchorjs-extras.eot +0 -0
- data/assets/javascript/anchor-js/docs/fonts/anchorjs-extras.svg +0 -11
- data/assets/javascript/anchor-js/docs/fonts/anchorjs-extras.ttf +0 -0
- data/assets/javascript/anchor-js/docs/fonts/anchorjs-extras.woff +0 -0
- data/assets/javascript/anchor-js/docs/fonts/fonts.css +0 -24
- data/assets/javascript/anchor-js/docs/grunticon/grunticon.loader.js +0 -3
- data/assets/javascript/anchor-js/docs/grunticon/icons.data.png.css +0 -5
- data/assets/javascript/anchor-js/docs/grunticon/icons.data.svg.css +0 -5
- data/assets/javascript/anchor-js/docs/grunticon/icons.fallback.css +0 -5
- data/assets/javascript/anchor-js/docs/grunticon/png/grunticon-link.png +0 -0
- data/assets/javascript/anchor-js/docs/grunticon/preview.html +0 -33
- data/assets/javascript/anchor-js/docs/img/anchoring-links.png +0 -0
- data/assets/javascript/anchor-js/docs/img/anchorjs_logo.png +0 -0
- data/assets/javascript/anchor-js/docs/img/anchorlinks2.png +0 -0
- data/assets/javascript/anchor-js/docs/img/gh-link.svg +0 -9
- data/assets/javascript/anchor-js/docs/img/gh_link.svg +0 -9
- data/assets/javascript/anchor-js/docs/img/hyperlink.svg +0 -9
- data/assets/javascript/anchor-js/docs/img/link.svg +0 -6
- data/assets/javascript/anchor-js/docs/img/mini-logo.png +0 -0
- data/assets/javascript/anchor-js/docs/img/primer-md.png +0 -0
- data/assets/javascript/anchor-js/docs/index.html +0 -807
- data/assets/javascript/anchor-js/docs/scripts.js +0 -12
- data/assets/javascript/anchor-js/docs/styles.css +0 -493
Binary file
|
Binary file
|
Binary file
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<svg width="24px" height="12px" viewBox="0 0 24 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3
|
-
<defs></defs>
|
4
|
-
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
5
|
-
<g id="link" fill="#FF5231">
|
6
|
-
<path d="M18,0 L14.765625,0 C15.890625,0.75 16.9453125,2.0859375 17.2734375,3 L17.9765625,3 C19.5,3 20.9765625,4.5 20.9765625,6 C20.9765625,7.5 19.453125,9 17.9765625,9 L13.4765625,9 C12,9 10.4765625,7.5 10.4765625,6 C10.4765625,5.4609375 10.640625,4.9453125 10.8984375,4.5 L7.6875,4.5 C7.5703125,4.9921875 7.5,5.484375 7.5,6 C7.5,9 10.4765625,12 13.4765625,12 L18,12 C21,12 24,9 24,6 C24,3 21,0 18,0 L18,0 Z M6.7265625,9 L6.0234375,9 C4.5,9 3.0234375,7.5 3.0234375,6 C3.0234375,4.5 4.546875,3 6.0234375,3 L10.5234375,3 C12,3 13.5234375,4.5 13.5234375,6 C13.5234375,6.5390625 13.359375,7.0546875 13.1015625,7.5 L16.3125,7.5 C16.4296875,7.0078125 16.5,6.515625 16.5,6 C16.5,3 13.5234375,0 10.5234375,0 L6,0 C3,0 0,3 0,6 C0,9 3,12 6,12 L9.234375,12 C8.109375,11.25 7.0546875,9.9140625 6.7265625,9 L6.7265625,9 Z" id="Shape"></path>
|
7
|
-
</g>
|
8
|
-
</g>
|
9
|
-
</svg>
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<svg width="20px" height="10px" viewBox="0 0 20 10" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3
|
-
<defs></defs>
|
4
|
-
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
5
|
-
<g id="link" fill="#FF5231">
|
6
|
-
<path d="M15,0 L12.3046875,0 C13.2421875,0.625 14.1210938,1.73828125 14.3945312,2.5 L14.9804688,2.5 C16.25,2.5 17.4804688,3.75 17.4804688,5 C17.4804688,6.25 16.2109375,7.5 14.9804688,7.5 L11.2304688,7.5 C10,7.5 8.73046875,6.25 8.73046875,5 C8.73046875,4.55078125 8.8671875,4.12109375 9.08203125,3.75 L6.40625,3.75 C6.30859375,4.16015625 6.25,4.5703125 6.25,5 C6.25,7.5 8.73046875,10 11.2304688,10 L15,10 C17.5,10 20,7.5 20,5 C20,2.5 17.5,0 15,0 L15,0 Z M5.60546875,7.5 L5.01953125,7.5 C3.75,7.5 2.51953125,6.25 2.51953125,5 C2.51953125,3.75 3.7890625,2.5 5.01953125,2.5 L8.76953125,2.5 C10,2.5 11.2695312,3.75 11.2695312,5 C11.2695312,5.44921875 11.1328125,5.87890625 10.9179688,6.25 L13.59375,6.25 C13.6914062,5.83984375 13.75,5.4296875 13.75,5 C13.75,2.5 11.2695312,0 8.76953125,0 L5,0 C2.5,0 0,2.5 0,5 C0,7.5 2.5,10 5,10 L7.6953125,10 C6.7578125,9.375 5.87890625,8.26171875 5.60546875,7.5 L5.60546875,7.5 Z" id="Shape"></path>
|
7
|
-
</g>
|
8
|
-
</g>
|
9
|
-
</svg>
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3
|
-
<defs></defs>
|
4
|
-
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
5
|
-
<g id="hyperlink" fill="#FF5231">
|
6
|
-
<path d="M23.5548327,6.22263035 L17.7774163,0.445167315 C17.2460545,-0.0861478599 16.3834086,-0.0861478599 15.8520934,0.445167315 L10.0747237,6.22263035 C9.5419144,6.75394553 9.5419144,7.61659144 10.0747237,8.14940078 L11.0366381,9.11131518 L16.8140545,3.33389883 L20.6661479,7.18599222 L14.8887315,12.9634086 L15.8520934,13.9267704 C16.3834086,14.4581323 17.2460545,14.4581323 17.7774163,13.9267704 L23.554786,8.14940078 C24.0861479,7.61659144 24.0861479,6.75389883 23.5548327,6.22263035 L23.5548327,6.22263035 Z M12.9634086,14.8886848 L7.18599222,20.6661479 L3.33389883,16.8140545 L9.11126848,11.0366381 L8.14790661,10.0732763 C7.61659144,9.5419144 6.75394553,9.5419144 6.22263035,10.0732763 L0.445167315,15.8506459 C-0.0861478599,16.3834086 -0.0861478599,17.2461012 0.445167315,17.7774163 L6.22258366,23.5548327 C6.75389883,24.0861479 7.61654475,24.0861479 8.14785992,23.5548327 L13.9252763,17.7774163 C14.4580389,17.2461012 14.4580389,16.3834553 13.9252763,15.8506459 L12.9634086,14.8886848 L12.9634086,14.8886848 Z M8.14790661,15.8506459 C8.68071595,16.3834086 9.5418677,16.3834086 10.0747237,15.8506459 L15.8520934,10.0732763 C16.3834086,9.5419144 16.3834086,8.68071595 15.8520934,8.14940078 C15.3193307,7.61663813 14.4581323,7.61663813 13.925323,8.14940078 L8.14790661,13.9267704 C7.61659144,14.4581323 7.61659144,15.3193307 8.14790661,15.8506459 L8.14790661,15.8506459 Z" id="Shape"></path>
|
7
|
-
</g>
|
8
|
-
</g>
|
9
|
-
</svg>
|
@@ -1,6 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3
|
-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" viewBox="0 0 512 512"><g id="icomoon-ignore">
|
4
|
-
</g>
|
5
|
-
<path d="M384 128h-69c24 16 46.5 44.5 53.5 64h15c32.5 0 64 32 64 64s-32.5 64-64 64h-96c-31.5 0-64-32-64-64 0-11.5 3.5-22.5 9-32h-68.5c-2.5 10.5-4 21-4 32 0 64 63.5 128 127.5 128s32.5 0 96.5 0 128-64 128-128-64-128-128-128zM143.5 320h-15c-32.5 0-64-32-64-64s32.5-64 64-64h96c31.5 0 64 32 64 64 0 11.5-3.5 22.5-9 32h68.5c2.5-10.5 4-21 4-32 0-64-63.5-128-127.5-128s-32.5 0-96.5 0-128 64-128 128 64 128 128 128h69c-24-16-46.5-44.5-53.5-64z"></path>
|
6
|
-
</svg>
|
Binary file
|
Binary file
|
@@ -1,807 +0,0 @@
|
|
1
|
-
<!doctype html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8">
|
5
|
-
<title>AnchorJS - Add deep anchor links to your docs</title>
|
6
|
-
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
7
|
-
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,400,700' rel='stylesheet' type='text/css'>
|
8
|
-
<link rel="stylesheet" href="styles.css">
|
9
|
-
<link rel="stylesheet" href="fonts/fonts.css">
|
10
|
-
<link rel="stylesheet" href="//cdn.jsdelivr.net/prism/1.5.1/themes/prism-twilight.css">
|
11
|
-
<script src="grunticon/grunticon.loader.js"></script>
|
12
|
-
<script>
|
13
|
-
grunticon(["grunticon/icons.data.svg.css", "grunticon/icons.data.png.css", "grunticon/icons.fallback.css"]);
|
14
|
-
</script>
|
15
|
-
<noscript>
|
16
|
-
<link href="grunticon/icons.fallback.css" rel="stylesheet">
|
17
|
-
</noscript>
|
18
|
-
</head>
|
19
|
-
<body>
|
20
|
-
<header class="header">
|
21
|
-
<h1 class="page-title">AnchorJS</h1>
|
22
|
-
<img class="logo" src="img/anchorjs_logo.png" />
|
23
|
-
<div class="desc">
|
24
|
-
<p class="maindesc">Add deep anchor links to your docs.</p>
|
25
|
-
<p class="subdesc">What are "deep anchor links"? Here are a few examples:</p>
|
26
|
-
</div>
|
27
|
-
<div class="preview-examples">
|
28
|
-
<div class="example">
|
29
|
-
<div class="example-content">
|
30
|
-
<h3 id="basic-link-preview">Basic Link</h3>
|
31
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
32
|
-
<a href="#" class="example-code-link">{}</a>
|
33
|
-
</div>
|
34
|
-
<div class="example-code">
|
35
|
-
<pre class="js"><code>anchors.options.visible = 'always';
|
36
|
-
anchors.add('h3');</code></pre>
|
37
|
-
</div>
|
38
|
-
</div>
|
39
|
-
<div class="example">
|
40
|
-
<div class="example-content">
|
41
|
-
<h3>Paragraph Link</h3>
|
42
|
-
<p id="paragraph-link-preview">Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
43
|
-
<a href="#" class="example-code-link">{}</a>
|
44
|
-
</div>
|
45
|
-
<div class="example-code">
|
46
|
-
<pre class="js"><code>anchors.options = {
|
47
|
-
visible: 'always',
|
48
|
-
placement: 'left',
|
49
|
-
icon: 'ΒΆ'
|
50
|
-
};
|
51
|
-
anchors.add('p');</code></pre>
|
52
|
-
</div>
|
53
|
-
</div>
|
54
|
-
</div>
|
55
|
-
<p class="more-examples"><a href="#examples">See more examples</a></p>
|
56
|
-
<div class="used-by">
|
57
|
-
<h2 class="used-by-label">Used by</h2>
|
58
|
-
<a href="http://primercss.io/about/"><img src="https://avatars.githubusercontent.com/u/7143434?v=3&s=120" alt="Primer CSS Logo" title="PrimerCSS"/></a>
|
59
|
-
<a href="http://getbootstrap.com/getting-started/"><img src="https://avatars.githubusercontent.com/u/2918581?v=3&s=120" alt="Bootstrap Logo" title="Bootstrap" /></a>
|
60
|
-
<a href="http://eslint.org/docs/rules/"><img src="https://avatars.githubusercontent.com/u/6019716?v=3&s=120" alt="ESLint logo" title="ESLint"/></a>
|
61
|
-
<a href="https://middlemanapp.com/basics/install/"><img src="https://avatars.githubusercontent.com/u/1280820?v=3&s=120" alt="Middleman logo" title="Middleman"/></a>
|
62
|
-
<a href="http://learn.getgrav.org/"><img src="https://avatars.githubusercontent.com/u/8237355?v=3&s=120" alt="Grav Logo" title="Grav" /></a>
|
63
|
-
</div>
|
64
|
-
</header>
|
65
|
-
<section class="main">
|
66
|
-
<h2>Overview</h2>
|
67
|
-
<img class="anchorlink-examples" src="img/anchorlinks2.png" alt="Examples of deep anchor links from across the web." />
|
68
|
-
<p>AnchorJS lets you drop deep anchor links (<a href="http://ux.stackexchange.com/q/36304/33248">like these</a>) onto any webpage, and be on your way.</p>
|
69
|
-
<p>You don't need to set up IDs or worry about urls. AnchorJS will respect your IDs if you have them, and generate them if you don't.</p>
|
70
|
-
<p>It uses an attractive link icon by default, but you can customize the display via <a href="#options">options</a> and CSS syling. The <a href="#examples">examples</a> demonstrate a few customization ideas.</p>
|
71
|
-
<p>Finally, AnchorJS is <strong>lightweight</strong>, <strong>accessible</strong>, and has <strong>no dependencies</strong>.</p>
|
72
|
-
|
73
|
-
<h2>Installation</h2>
|
74
|
-
|
75
|
-
<p>Download AnchorJS using npm,</p>
|
76
|
-
<pre><code>npm install anchor-js</code></pre>
|
77
|
-
<p>or bower:</p>
|
78
|
-
<pre><code>bower install anchor-js</code></pre>
|
79
|
-
<p>(or just <a href="https://github.com/bryanbraun/anchorjs/releases">download it from github</a>).</p>
|
80
|
-
<p>Then include the anchor.js file (or anchor.min.js) in your webpage.</p>
|
81
|
-
<pre><code class="language-markup"><script src="anchor.js"></script></code></pre>
|
82
|
-
<p>You could also include it via a CDN like <a href="https://cdnjs.com/libraries/anchor-js">CDNJS</a> or <a href="http://www.jsdelivr.com/projects/anchorjs">jsDelivr</a>.</p>
|
83
|
-
<p>If you're using it from Node/CommonJS, include it via:</p>
|
84
|
-
<pre class="src-js"><code>var anchorJS = require('anchor-js');
|
85
|
-
var anchors = new anchorJS();</code></pre>
|
86
|
-
|
87
|
-
<h2>Basic usage</h2>
|
88
|
-
<p>AnchorJS provides the <code>anchors.add()</code> method which takes a CSS selector (similar to jQuery) for targeting elements you want to deep-link. Here are some usage examples.</p>
|
89
|
-
<pre class="src-js"><code>/**
|
90
|
-
* Example 1
|
91
|
-
* Add anchors to all h1's on the page
|
92
|
-
*/
|
93
|
-
anchors.add('h1');
|
94
|
-
|
95
|
-
/**
|
96
|
-
* Example 2
|
97
|
-
* Adds anchors to elements that have been assigned the class '.anchored'
|
98
|
-
*/
|
99
|
-
anchors.add('.anchored');
|
100
|
-
|
101
|
-
/**
|
102
|
-
* Example 3
|
103
|
-
* If no selector is provided, it falls back to a default selector of:
|
104
|
-
* 'h2, h3, h4, h5, h6'
|
105
|
-
*/
|
106
|
-
anchors.add();</code></pre>
|
107
|
-
|
108
|
-
<h3>Don't run it too late!</h3>
|
109
|
-
<p>You need to add anchors to the page early in the page load process if you want browsers to jump to the ID properly.</p>
|
110
|
-
<p>We recommend you call <code>anchors.add()</code> before the DOM finishes loading...</p>
|
111
|
-
|
112
|
-
<pre><code class="language-markup"><!-- Add anchors before the closing body tag. -->
|
113
|
-
<script>
|
114
|
-
anchors.add();
|
115
|
-
</script>
|
116
|
-
</body></code></pre>
|
117
|
-
<p>...or on DOMContentLoaded:</p>
|
118
|
-
<pre class="src-js"><code>// Add anchors on DOMContentLoaded
|
119
|
-
document.addEventListener("DOMContentLoaded", function(event) {
|
120
|
-
anchors.add();
|
121
|
-
});</code></pre>
|
122
|
-
|
123
|
-
<p>Don't add anchors on later events, like <code>$(document).ready()</code> or <code>window.onload</code> as some browsers will attempt to jump to your ID before AnchorJS can add it to the page. For more details, see <a href="https://github.com/bryanbraun/anchorjs/issues/69#issuecomment-255503575">github issue #69</a>).</p>
|
124
|
-
|
125
|
-
<h2>Options</h2>
|
126
|
-
<p>You can set a number of options to customize how your anchors look:</p>
|
127
|
-
<table class='options-table'>
|
128
|
-
<thead>
|
129
|
-
<tr>
|
130
|
-
<th>Option</th>
|
131
|
-
<th class="minicol">Accepted Values</th>
|
132
|
-
<th class="minicol">Default Value</th>
|
133
|
-
<th>Description</th>
|
134
|
-
</tr>
|
135
|
-
</thead>
|
136
|
-
<tbody>
|
137
|
-
<tr>
|
138
|
-
<td><code>placement</code></td>
|
139
|
-
<td><code>right</code> <br> <code>left</code></td>
|
140
|
-
<td><code>right</code></td>
|
141
|
-
<td><code>right</code> appends the anchor to the end of the element.<br> <code>left</code> places it to the left, in the margin.</td>
|
142
|
-
</tr>
|
143
|
-
<tr>
|
144
|
-
<td><code>visible</code></td>
|
145
|
-
<td><code>hover</code> <br> <code>always</code> <br> <code>touch</code></td></td>
|
146
|
-
<td><code>hover</code></td>
|
147
|
-
<td><code>hover</code> displays the anchor when hovering over the element.<br> <code>always</code> will always display the anchor link. <br> <code>touch</code> will <em>always</em> display anchors for devices that support touch events, and only display them via <em>hover</em> for devices that do not support touch events. This approximates touchscreen detection (but <a href="http://www.stucox.com/blog/you-cant-detect-a-touchscreen/">isn't 100% accurate</a>).</td>
|
148
|
-
</tr>
|
149
|
-
<tr>
|
150
|
-
<td><code>icon</code></td>
|
151
|
-
<td>(any unicode character)</td>
|
152
|
-
<td><code style="font-family: 'anchorjs-icons'; font-size: 24px; -webkit-font-smoothing: antialiased;">ξ§</code></td>
|
153
|
-
<td>Replace the default link icon with the character(s) provided. These are a few good options: <code>#</code>, <code>ΒΆ</code>, <code>β‘</code>, and <code>Β§</code>.</td>
|
154
|
-
</tr>
|
155
|
-
<tr>
|
156
|
-
<td><code>class</code></td>
|
157
|
-
<td>(any string)</td>
|
158
|
-
<td>(none)</td>
|
159
|
-
<td>Adds the provided class(es) to the anchor html.</td>
|
160
|
-
</tr>
|
161
|
-
<tr>
|
162
|
-
<td><code>truncate</code></td>
|
163
|
-
<td>(any positive number)</td>
|
164
|
-
<td><code>64</code></td>
|
165
|
-
<td>Truncates the generated ID to the specified character length. <small>Note: the length may not be exactly the same, if there are dangling spaces or hyphens to be trimmed.</small></td>
|
166
|
-
</tr>
|
167
|
-
</tbody>
|
168
|
-
</table>
|
169
|
-
<p>For example:</p>
|
170
|
-
<pre class="src-js"><code>/**
|
171
|
-
* Example 1
|
172
|
-
* Add anchors to all h1s, h2s and h3s inside of #post.
|
173
|
-
* Anchors will be always visible.
|
174
|
-
*/
|
175
|
-
anchors.options.visible = 'always';
|
176
|
-
anchors.add('#post h1, #post h2, #post h3');
|
177
|
-
|
178
|
-
/**
|
179
|
-
* Example 2
|
180
|
-
* Provide options as an object before adding anchors to the page.
|
181
|
-
* Adds always-visible ΒΆ anchors in the left margin of each p tag inside .story
|
182
|
-
*/
|
183
|
-
anchors.options = {
|
184
|
-
placement: 'left',
|
185
|
-
visible: 'always',
|
186
|
-
icon: 'ΒΆ'
|
187
|
-
};
|
188
|
-
anchors.add('.story > p');</code></pre>
|
189
|
-
|
190
|
-
<h2>Advanced usage</h2>
|
191
|
-
|
192
|
-
<section id="section-ids">
|
193
|
-
<h3 data-anchor-id="section-ids">Section IDs</h3>
|
194
|
-
<p>In some cases, you might want to link to existing section IDs instead of the heading element itself. You can instruct AnchorJS to do this with the <code>data-anchor-id</code> attribute:</p>
|
195
|
-
<pre><code class="language-markup"><section id="section-1">
|
196
|
-
<h3 data-anchor-id="section-1">Section 1</h3>
|
197
|
-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed...</p>
|
198
|
-
</section></code></pre>
|
199
|
-
<p>This allows you to do things like <a href="https://css-tricks.com/on-target/#article-header-id-3">highlight sections when your users jump to them</a>.</p>
|
200
|
-
</section>
|
201
|
-
|
202
|
-
<h3>Removing anchors</h3>
|
203
|
-
<p>You can remove anchors with the <code>anchors.remove()</code> or <code>anchors.removeAll()</code> methods:</p>
|
204
|
-
<pre class="src-js"><code>/**
|
205
|
-
* Example 1
|
206
|
-
* Remove anchors from all h1s on the page.
|
207
|
-
*/
|
208
|
-
anchors.remove('h1');
|
209
|
-
|
210
|
-
/**
|
211
|
-
* Example 2
|
212
|
-
* Remove all anchors from the page.
|
213
|
-
*/
|
214
|
-
anchors.removeAll();</pre></code>
|
215
|
-
<p>Removing anchors with <code>.remove()</code> should be uncommon. If you simply want anchors on a more selective group, consider using <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:not">the CSS <em>:not()</em> pseudo-class</a> when you add them, like so:</p>
|
216
|
-
<pre class="src-js"><code>/**
|
217
|
-
* Example 2
|
218
|
-
* Add anchors to all h2s, except for those with a class of "no-anchor".
|
219
|
-
*/
|
220
|
-
anchors.add('h2:not(.no-anchor)');</pre></code>
|
221
|
-
|
222
|
-
<h3>Chaining commands</h3>
|
223
|
-
<p>You can chain commands of <code>add()</code> and <code>remove()</code> (since they return a copy of <code>anchors</code>), but it's usually more performant to lean on CSS when targeting elements:
|
224
|
-
|
225
|
-
<pre class="src-js"><code>/**
|
226
|
-
* Example 1
|
227
|
-
* Adds anchors to `.my-anchors` and `.my-other-anchors` except for those
|
228
|
-
* with a class of `no-anchor`.
|
229
|
-
*/
|
230
|
-
anchors.add('.my-anchors').add('.my-other-anchors').remove('.no-anchor');
|
231
|
-
|
232
|
-
/**
|
233
|
-
* Example 2
|
234
|
-
* A more performant way to add anchors to the same classes in Example 1 above.
|
235
|
-
*/
|
236
|
-
anchors.add('.my-anchors:not(.no-anchor), .my-other-anchors:not(.no-anchor)');</code></pre>
|
237
|
-
|
238
|
-
<h3>Multiple sets of anchors</h3>
|
239
|
-
<p>You can have multiple sets of anchors on one page, each with their own design. To do so, just create your own instances of the AnchorJS object:</p>
|
240
|
-
<pre class="src-js"><code>var sidebarAnchors = new AnchorJS();
|
241
|
-
anchors.add('.main h2'); // The default instance.
|
242
|
-
sidebarAnchors.add('.sidebar h2'); // The new instance.</code></pre>
|
243
|
-
<p>You can preset your instance with whatever options you like:</p>
|
244
|
-
<pre class="src-js"><code>var sidebarAnchors = new AnchorJS({
|
245
|
-
placement: 'left',
|
246
|
-
icon: 'ΒΆ'
|
247
|
-
});
|
248
|
-
sidebarAnchors.add('.sidebar h2');</code></pre>
|
249
|
-
|
250
|
-
<h3>Generating navigations</h3>
|
251
|
-
<p>AnchorJS doesn't include methods for dynamically generating navigations (like a table of contents or jump nav). This is to keep AnchorJS lightweight and simple for the most common usecases.</p>
|
252
|
-
<p>However, AnchorJS <em>does</em> expose a list of all anchored elements at <code>anchors.elements</code>. This way, external code can look up the elements and use them to generate navigations (as shown in <a href="https://jsfiddle.net/bryanbraun/nc6rL9hk/">this example</a>).</p>
|
253
|
-
<p>You can also use AnchorJS alongside a static navigation with pre-defined IDs (as is done in <a href="https://jsfiddle.net/bryanbraun/x85hfvbk/">this example</a>).</p>
|
254
|
-
|
255
|
-
<h2>Examples</h2>
|
256
|
-
<div class="examples">
|
257
|
-
<div class="example">
|
258
|
-
<div class="example-content">
|
259
|
-
<h3>Basic Link</h3>
|
260
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
261
|
-
<a href="#" class="example-code-link">{}</a>
|
262
|
-
</div>
|
263
|
-
<div class="example-code">
|
264
|
-
<pre class="js"><code>anchors.options.visible = 'always';
|
265
|
-
anchors.add('h3');</code></pre>
|
266
|
-
</div>
|
267
|
-
</div>
|
268
|
-
<div class="example">
|
269
|
-
<div class="example-content">
|
270
|
-
<h3>Basic Link - Left</h3>
|
271
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
272
|
-
<a href="#" class="example-code-link">{}</a>
|
273
|
-
</div>
|
274
|
-
<div class="example-code">
|
275
|
-
<pre class="js"><code>anchors.options = {
|
276
|
-
visible: 'always',
|
277
|
-
placement: 'left'
|
278
|
-
};
|
279
|
-
anchors.add('h3');</code></pre>
|
280
|
-
</div>
|
281
|
-
</div>
|
282
|
-
<div class="example">
|
283
|
-
<div class="example-content">
|
284
|
-
<h3>Paragraph Link</h3>
|
285
|
-
<p id="paragraph-link">Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
286
|
-
<a href="#" class="example-code-link">{}</a>
|
287
|
-
</div>
|
288
|
-
<div class="example-code">
|
289
|
-
<pre class="js"><code>anchors.options = {
|
290
|
-
visible: 'always',
|
291
|
-
placement: 'left',
|
292
|
-
icon: 'ΒΆ'
|
293
|
-
};
|
294
|
-
anchors.add('p');</code></pre>
|
295
|
-
</div>
|
296
|
-
</div>
|
297
|
-
<div class="example">
|
298
|
-
<div class="example-content">
|
299
|
-
<h3>Octothorp</h3>
|
300
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
301
|
-
<a href="#" class="example-code-link">{}</a>
|
302
|
-
</div>
|
303
|
-
<div class="example-code">
|
304
|
-
<pre class="js"><code>anchors.options = {
|
305
|
-
visible: 'always',
|
306
|
-
icon: '#'
|
307
|
-
};
|
308
|
-
anchors.add('h3');</code></pre>
|
309
|
-
</div>
|
310
|
-
</div>
|
311
|
-
<div class="example">
|
312
|
-
<div class="example-content">
|
313
|
-
<h3>Unicode Icon 1</h3>
|
314
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
315
|
-
<a href="#" class="example-code-link">{}</a>
|
316
|
-
</div>
|
317
|
-
<div class="example-code">
|
318
|
-
<pre class="js"><code>anchors.options = {
|
319
|
-
visible: 'always',
|
320
|
-
placement: 'left',
|
321
|
-
icon: 'Β§'
|
322
|
-
};
|
323
|
-
anchors.add('h3');</code></pre>
|
324
|
-
</div>
|
325
|
-
</div>
|
326
|
-
<div class="example">
|
327
|
-
<div class="example-content">
|
328
|
-
<h3>Unicode Icon 2</h3>
|
329
|
-
<p id="unicode-icon-2">Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
330
|
-
<a href="#" class="example-code-link">{}</a>
|
331
|
-
</div>
|
332
|
-
<div class="example-code">
|
333
|
-
<pre class="js"><code>anchors.options = {
|
334
|
-
visible: 'always',
|
335
|
-
icon: 'β‘'
|
336
|
-
};
|
337
|
-
anchors.add('p');</code></pre>
|
338
|
-
</div>
|
339
|
-
</div>
|
340
|
-
<div class="example">
|
341
|
-
<div class="example-content">
|
342
|
-
<h3>Custom Text</h3>
|
343
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
344
|
-
<a href="#" class="example-code-link">{}</a>
|
345
|
-
</div>
|
346
|
-
<div class="example-code">
|
347
|
-
<pre class="js"><code>anchors.options = {
|
348
|
-
visible: 'always',
|
349
|
-
icon: '# LINK'
|
350
|
-
};
|
351
|
-
anchors.add('h3');</code></pre>
|
352
|
-
<pre class="css"><code>.anchorjs-link {
|
353
|
-
font-weight: 200;
|
354
|
-
margin-left: 1em;
|
355
|
-
padding-right: 0.375em;
|
356
|
-
font-size: 0.5em;
|
357
|
-
border: 1px dashed #FFBAAC;
|
358
|
-
vertical-align: middle;
|
359
|
-
}</code></pre>
|
360
|
-
</div>
|
361
|
-
</div>
|
362
|
-
<div class="example">
|
363
|
-
<div class="example-content">
|
364
|
-
<h3>Custom Image</h3>
|
365
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
366
|
-
<a href="#" class="example-code-link">{}</a>
|
367
|
-
</div>
|
368
|
-
<div class="example-code">
|
369
|
-
<pre class="js"><code>// Use an empty string ('') for the icon when styling the background with CSS.
|
370
|
-
anchors.options = {
|
371
|
-
visible: 'always',
|
372
|
-
placement: 'left',
|
373
|
-
icon: ''
|
374
|
-
};
|
375
|
-
anchors.add('h3');</code></pre>
|
376
|
-
<pre class="css"><code>.anchorjs-link {
|
377
|
-
width: 14px;
|
378
|
-
height: 32px;
|
379
|
-
margin-top: 6px;
|
380
|
-
margin-left: -1.25em !important;
|
381
|
-
background: url('img/mini-logo.png') no-repeat;
|
382
|
-
}</code></pre>
|
383
|
-
</div>
|
384
|
-
</div>
|
385
|
-
<div class="example">
|
386
|
-
<div class="example-content">
|
387
|
-
<h3>Link w/CSS Styling</h3>
|
388
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
389
|
-
<a href="#" class="example-code-link">{}</a>
|
390
|
-
</div>
|
391
|
-
<div class="example-code">
|
392
|
-
<pre class="js"><code>anchors.options = {
|
393
|
-
visible: 'always',
|
394
|
-
placement: 'left'
|
395
|
-
};
|
396
|
-
anchors.add('h3');</code></pre>
|
397
|
-
<pre class="css"><code>.anchorjs-link {
|
398
|
-
display: inline-block;
|
399
|
-
height: 32px;
|
400
|
-
width: 18px;
|
401
|
-
border-radius: 50%;
|
402
|
-
background-color: #FF5231;
|
403
|
-
color: white;
|
404
|
-
margin-top: 4px;
|
405
|
-
margin-left: -1.4em !important;
|
406
|
-
}
|
407
|
-
.anchorjs-link:before {
|
408
|
-
margin-left: 7px;
|
409
|
-
margin-top: -4px;
|
410
|
-
display: block;
|
411
|
-
}</code></pre>
|
412
|
-
</div>
|
413
|
-
</div>
|
414
|
-
<div class="example">
|
415
|
-
<div class="example-content">
|
416
|
-
<h3>Icon Font</h3>
|
417
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
418
|
-
<a href="#" class="example-code-link">{}</a>
|
419
|
-
</div>
|
420
|
-
<div class="example-code">
|
421
|
-
<pre class="js"><code>// Just pass in the octal code for your icon-font character.
|
422
|
-
anchors.options = {
|
423
|
-
visible: 'always',
|
424
|
-
icon: '\uf0c1'
|
425
|
-
};
|
426
|
-
anchors.add('h3');</code></pre>
|
427
|
-
<pre class="css"><code>.anchorjs-link {
|
428
|
-
font-family: 'your-icon-font';
|
429
|
-
}</code></pre>
|
430
|
-
</div>
|
431
|
-
</div>
|
432
|
-
<div class="example">
|
433
|
-
<div class="example-content">
|
434
|
-
<h3>SVG Icon</h3>
|
435
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
436
|
-
<a href="#" class="example-code-link">{}</a>
|
437
|
-
</div>
|
438
|
-
<div class="example-code">
|
439
|
-
<pre class="js"><code>anchors.options = {
|
440
|
-
visible: 'always',
|
441
|
-
icon: ''
|
442
|
-
};
|
443
|
-
anchors.add('h3');</code></pre>
|
444
|
-
<pre class="css"><code>.anchorjs-link {
|
445
|
-
display: inline-block;
|
446
|
-
background: url('img/hyperlink.svg') no-repeat;
|
447
|
-
margin-left: 8px;
|
448
|
-
width: 14px;
|
449
|
-
height: 24px;
|
450
|
-
}</code></pre>
|
451
|
-
</div>
|
452
|
-
</div>
|
453
|
-
<div class="example">
|
454
|
-
<div class="example-content">
|
455
|
-
<h3>Base64 Icon</h3>
|
456
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
457
|
-
<a href="#" class="example-code-link">{}</a>
|
458
|
-
</div>
|
459
|
-
<div class="example-code">
|
460
|
-
<pre class="js"><code>anchors.options = {
|
461
|
-
visible: 'always',
|
462
|
-
placement: 'left',
|
463
|
-
icon: ''
|
464
|
-
};
|
465
|
-
anchors.add('h3');</code></pre>
|
466
|
-
<pre class="css"><code>.anchorjs-link {
|
467
|
-
background: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjIwcHgiIGhlaWdodD0iMTBweCIgdmlld0JveD0iMCAwIDIwIDEwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9ImxpbmsiIGZpbGw9IiNGRjUyMzEiPgogICAgICAgICAgICA8cGF0aCBkPSJNMTUsMCBMMTIuMzA0Njg3NSwwIEMxMy4yNDIxODc1LDAuNjI1IDE0LjEyMTA5MzgsMS43MzgyODEyNSAxNC4zOTQ1MzEyLDIuNSBMMTQuOTgwNDY4OCwyLjUgQzE2LjI1LDIuNSAxNy40ODA0Njg4LDMuNzUgMTcuNDgwNDY4OCw1IEMxNy40ODA0Njg4LDYuMjUgMTYuMjEwOTM3NSw3LjUgMTQuOTgwNDY4OCw3LjUgTDExLjIzMDQ2ODgsNy41IEMxMCw3LjUgOC43MzA0Njg3NSw2LjI1IDguNzMwNDY4NzUsNSBDOC43MzA0Njg3NSw0LjU1MDc4MTI1IDguODY3MTg3NSw0LjEyMTA5Mzc1IDkuMDgyMDMxMjUsMy43NSBMNi40MDYyNSwzLjc1IEM2LjMwODU5Mzc1LDQuMTYwMTU2MjUgNi4yNSw0LjU3MDMxMjUgNi4yNSw1IEM2LjI1LDcuNSA4LjczMDQ2ODc1LDEwIDExLjIzMDQ2ODgsMTAgTDE1LDEwIEMxNy41LDEwIDIwLDcuNSAyMCw1IEMyMCwyLjUgMTcuNSwwIDE1LDAgTDE1LDAgWiBNNS42MDU0Njg3NSw3LjUgTDUuMDE5NTMxMjUsNy41IEMzLjc1LDcuNSAyLjUxOTUzMTI1LDYuMjUgMi41MTk1MzEyNSw1IEMyLjUxOTUzMTI1LDMuNzUgMy43ODkwNjI1LDIuNSA1LjAxOTUzMTI1LDIuNSBMOC43Njk1MzEyNSwyLjUgQzEwLDIuNSAxMS4yNjk1MzEyLDMuNzUgMTEuMjY5NTMxMiw1IEMxMS4yNjk1MzEyLDUuNDQ5MjE4NzUgMTEuMTMyODEyNSw1Ljg3ODkwNjI1IDEwLjkxNzk2ODgsNi4yNSBMMTMuNTkzNzUsNi4yNSBDMTMuNjkxNDA2Miw1LjgzOTg0Mzc1IDEzLjc1LDUuNDI5Njg3NSAxMy43NSw1IEMxMy43NSwyLjUgMTEuMjY5NTMxMiwwIDguNzY5NTMxMjUsMCBMNSwwIEMyLjUsMCAwLDIuNSAwLDUgQzAsNy41IDIuNSwxMCA1LDEwIEw3LjY5NTMxMjUsMTAgQzYuNzU3ODEyNSw5LjM3NSA1Ljg3ODkwNjI1LDguMjYxNzE4NzUgNS42MDU0Njg3NSw3LjUgTDUuNjA1NDY4NzUsNy41IFoiIGlkPSJTaGFwZSI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+") no-repeat;
|
468
|
-
margin-top: 15px;
|
469
|
-
height: 16px;
|
470
|
-
width: 20px;
|
471
|
-
}</code></pre>
|
472
|
-
</div>
|
473
|
-
</div>
|
474
|
-
<div class="example">
|
475
|
-
<div class="example-content">
|
476
|
-
<h3>CSS Icon</h3>
|
477
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
478
|
-
<a href="#" class="example-code-link">{}</a>
|
479
|
-
</div>
|
480
|
-
<div class="example-code">
|
481
|
-
<pre class="js"><code>anchors.options = {
|
482
|
-
visible: 'always',
|
483
|
-
placement: 'left',
|
484
|
-
icon: ''
|
485
|
-
};
|
486
|
-
anchors.add('h3');</code></pre>
|
487
|
-
<pre class="css"><code>/* See also: nicolasgallagher.com/pure-css-gui-icons */
|
488
|
-
.anchorjs-link {
|
489
|
-
border-color: #FF5231 #FF5231 transparent;
|
490
|
-
border-width: 15px 7px 6px;
|
491
|
-
border-style: solid;
|
492
|
-
margin-top: 10px;
|
493
|
-
font-size: 22px;
|
494
|
-
padding-right: 0 !important;
|
495
|
-
}</code></pre>
|
496
|
-
</div>
|
497
|
-
</div>
|
498
|
-
<div class="example">
|
499
|
-
<div class="example-content">
|
500
|
-
<h3>Emoji</h3>
|
501
|
-
<p id="emoji">Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
502
|
-
<a href="#" class="example-code-link">{}</a>
|
503
|
-
</div>
|
504
|
-
<div class="example-code">
|
505
|
-
<pre class="js"><code>anchors.options = {
|
506
|
-
visible: 'always',
|
507
|
-
placement: 'left',
|
508
|
-
icon: 'β'
|
509
|
-
};
|
510
|
-
anchors.add('p');</code></pre>
|
511
|
-
<pre class="css"><code>.anchorjs-link {
|
512
|
-
margin-left: -1.8em !important;
|
513
|
-
}</code></pre>
|
514
|
-
</div>
|
515
|
-
</div>
|
516
|
-
|
517
|
-
<div class="example">
|
518
|
-
<div class="example-content">
|
519
|
-
<h3>Grunticon</h3>
|
520
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
521
|
-
<a href="#" class="example-code-link">{}</a>
|
522
|
-
</div>
|
523
|
-
<div class="example-code">
|
524
|
-
<pre class="js"><code>// Assuming you have set up
|
525
|
-
// grunticon and you have a
|
526
|
-
// grunticon class named
|
527
|
-
// 'icon-grunticon-link'...
|
528
|
-
anchors.options = {
|
529
|
-
visible: 'always',
|
530
|
-
class: 'icon-grunticon-link'
|
531
|
-
icon: ''
|
532
|
-
};
|
533
|
-
anchors.add('h3');</code></pre>
|
534
|
-
<pre class="css"><code>.anchorjs-link {
|
535
|
-
display: inline-block;
|
536
|
-
margin-left: 0.375em;
|
537
|
-
width: 0.375em;
|
538
|
-
height: 20px;
|
539
|
-
}</code></pre>
|
540
|
-
</div>
|
541
|
-
</div>
|
542
|
-
|
543
|
-
</div>
|
544
|
-
|
545
|
-
<h2 id="hover-examples" class="title">Hover examples</h2>
|
546
|
-
<div class="hover-examples">
|
547
|
-
<div class="example">
|
548
|
-
<div class="example-content">
|
549
|
-
<h3>Basic Hover</h3>
|
550
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
551
|
-
<a href="#" class="example-code-link">{}</a>
|
552
|
-
</div>
|
553
|
-
<div class="example-code">
|
554
|
-
<pre class="js"><code>anchors.add('h3');</code></pre>
|
555
|
-
</div>
|
556
|
-
</div>
|
557
|
-
<div class="example">
|
558
|
-
<div class="example-content">
|
559
|
-
<h3>Color Transition</h3>
|
560
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
561
|
-
<a href="#" class="example-code-link">{}</a>
|
562
|
-
</div>
|
563
|
-
<div class="example-code">
|
564
|
-
<pre class="js"><code>anchors.add('h3');</code></pre>
|
565
|
-
<pre class="css"><code>.anchorjs-link:hover {
|
566
|
-
color: #2500AD;
|
567
|
-
}
|
568
|
-
*:hover > .anchorjs-link {
|
569
|
-
transition: color .25s linear;
|
570
|
-
}</code></pre>
|
571
|
-
</div>
|
572
|
-
</div>
|
573
|
-
<div class="example">
|
574
|
-
<div class="example-content">
|
575
|
-
<h3>Shift Out</h3>
|
576
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
577
|
-
<a href="#" class="example-code-link">{}</a>
|
578
|
-
</div>
|
579
|
-
<div class="example-code">
|
580
|
-
<pre class="js"><code>anchors.options.placement = 'left';
|
581
|
-
anchors.add('h3');</code></pre>
|
582
|
-
<pre class="css"><code>.anchorjs-link {
|
583
|
-
transition: all .25s linear;
|
584
|
-
}
|
585
|
-
*:hover > .anchorjs-link {
|
586
|
-
margin-left: -1.125em !important;
|
587
|
-
}</code></pre>
|
588
|
-
</div>
|
589
|
-
</div>
|
590
|
-
|
591
|
-
<div class="example">
|
592
|
-
<div class="example-content">
|
593
|
-
<h3>Arrow</h3>
|
594
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
595
|
-
<a href="#" class="example-code-link">{}</a>
|
596
|
-
</div>
|
597
|
-
<div class="example-code">
|
598
|
-
<pre class="js"><code>anchors.options.icon = '# LINK';
|
599
|
-
anchors.add('h3');</code></pre>
|
600
|
-
<pre class="css"><code>/* Based on http://codepen.io/corysimmons/pen/NPBXbe */
|
601
|
-
/* Vendor prefixes not included */
|
602
|
-
.anchorjs-link {
|
603
|
-
position: relative;
|
604
|
-
top: 4px;
|
605
|
-
height: 36px;
|
606
|
-
flex: 1;
|
607
|
-
background: #FF5231;
|
608
|
-
color: white;
|
609
|
-
font-family: Helvetica, Arial, sans-serif;
|
610
|
-
font-weight: 200;
|
611
|
-
font-size: 1rem;
|
612
|
-
margin-right: -6%;
|
613
|
-
padding-right: 6%;
|
614
|
-
padding-left: 42px !important;
|
615
|
-
line-height: 38px;
|
616
|
-
transition: all 0.5s ease;
|
617
|
-
transform: translateX(100%);
|
618
|
-
}
|
619
|
-
.anchorjs-link::before {
|
620
|
-
position: absolute;
|
621
|
-
display: block;
|
622
|
-
left: 0;
|
623
|
-
width: 0;
|
624
|
-
height: 0;
|
625
|
-
content: '';
|
626
|
-
border: 18px solid #fdfdfd; /* Background color */
|
627
|
-
border-right-color: #FF5231;
|
628
|
-
transition: all 0.5s ease;
|
629
|
-
}
|
630
|
-
h2 {
|
631
|
-
display: flex;
|
632
|
-
}
|
633
|
-
*:hover > .anchorjs-link {
|
634
|
-
transform: translateX(0);
|
635
|
-
}
|
636
|
-
*:hover > .anchorjs-link:hover {
|
637
|
-
background: #FF806A;
|
638
|
-
}
|
639
|
-
*:hover > .anchorjs-link:hover::before {
|
640
|
-
border-right-color: #FF806A;
|
641
|
-
}</code></pre>
|
642
|
-
</div>
|
643
|
-
</div>
|
644
|
-
|
645
|
-
<div class="example">
|
646
|
-
<div class="example-content">
|
647
|
-
<h3>Tooltip</h3>
|
648
|
-
<p>Lorem ipsum dolor consectetur amet nulla elit. Vivamus luctus urna sed urna ultricies. Vivamus luctus urna sed.</p>
|
649
|
-
<a href="#" class="example-code-link">{}</a>
|
650
|
-
</div>
|
651
|
-
<div class="example-code">
|
652
|
-
<pre class="js"><code>anchors.options = { icon: 'Permalink' };
|
653
|
-
anchors.add('h3');</code></pre>
|
654
|
-
<pre class="css"><code>/* tooltip box */
|
655
|
-
.anchorjs-link:after {
|
656
|
-
display: inline-block;
|
657
|
-
transition: opacity .25s linear;
|
658
|
-
font-family: Verdana, sans-serif;
|
659
|
-
font-size: 0.75ex;
|
660
|
-
font-weight: 100;
|
661
|
-
padding: 0.5ex 1.5ex;
|
662
|
-
background: #444;
|
663
|
-
color: #fff;
|
664
|
-
border-radius: 0.6ex;
|
665
|
-
vertical-align: 0.8ex;
|
666
|
-
}
|
667
|
-
/* tooltip arrow */
|
668
|
-
.anchorjs-link:before {
|
669
|
-
content: '';
|
670
|
-
display: inline-block;
|
671
|
-
border-top: 0.3ex solid transparent;
|
672
|
-
border-right: 0.5ex solid #444;
|
673
|
-
border-bottom: 0.3ex solid transparent;
|
674
|
-
vertical-align: 0.35ex;
|
675
|
-
}
|
676
|
-
.anchorjs-link:hover:after {
|
677
|
-
background-color: #666;
|
678
|
-
}
|
679
|
-
.anchorjs-link:hover:before {
|
680
|
-
border-right-color: #666;
|
681
|
-
}</code></pre>
|
682
|
-
</div>
|
683
|
-
</div>
|
684
|
-
|
685
|
-
</div>
|
686
|
-
<footer class="footer"><p><small>Made by <a href="http://www.bryanbraun.com">Bryan</a>. You should <a href="https://twitter.com/intent/tweet?text=Hi%20%40BryanEBraun%2C%20">say hi</a> sometime. π</small></p></footer>
|
687
|
-
<a href="https://github.com/bryanbraun/anchorjs"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://github-camo.global.ssl.fastly.net/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
|
688
|
-
</section>
|
689
|
-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
690
|
-
<script src="anchor.js"></script>
|
691
|
-
<script src="scripts.js"></script>
|
692
|
-
<script>
|
693
|
-
anchors.add('.main > h2, .main > h3, .main > section > h2, .main > section > h3').remove('.used-by-label');
|
694
|
-
|
695
|
-
var ex1 = new AnchorJS({ visible: 'always' });
|
696
|
-
ex1.add('.examples .example:nth-child(1) h3, .preview-examples .example:nth-child(1) h3');
|
697
|
-
|
698
|
-
var ex2 = new AnchorJS({
|
699
|
-
placement: 'left',
|
700
|
-
visible: 'always'
|
701
|
-
});
|
702
|
-
ex2.add('.examples .example:nth-child(2) h3');
|
703
|
-
|
704
|
-
var ex3 = new AnchorJS({
|
705
|
-
icon: 'ΒΆ',
|
706
|
-
visible: 'always',
|
707
|
-
placement: 'left'
|
708
|
-
});
|
709
|
-
ex3.add('.examples .example:nth-child(3) p, .preview-examples .example:nth-child(2) p');
|
710
|
-
|
711
|
-
var ex4 = new AnchorJS({
|
712
|
-
icon: '#',
|
713
|
-
visible: 'always'
|
714
|
-
});
|
715
|
-
ex4.add('.examples .example:nth-child(4) h3');
|
716
|
-
|
717
|
-
var ex5 = new AnchorJS({
|
718
|
-
icon: 'Β§',
|
719
|
-
visible: 'always',
|
720
|
-
placement: 'left'
|
721
|
-
});
|
722
|
-
ex5.add('.examples .example:nth-child(5) h3');
|
723
|
-
|
724
|
-
var ex6 = new AnchorJS({
|
725
|
-
icon: 'β‘',
|
726
|
-
visible: 'always'
|
727
|
-
});
|
728
|
-
ex6.add('.examples .example:nth-child(6) p');
|
729
|
-
|
730
|
-
var ex7 = new AnchorJS({
|
731
|
-
icon: '# LINK',
|
732
|
-
visible: 'always'
|
733
|
-
});
|
734
|
-
ex7.add('.examples .example:nth-child(7) h3');
|
735
|
-
|
736
|
-
var ex8 = new AnchorJS({
|
737
|
-
icon: '',
|
738
|
-
visible: 'always',
|
739
|
-
placement: 'left'
|
740
|
-
});
|
741
|
-
ex8.add('.examples .example:nth-child(8) h3');
|
742
|
-
|
743
|
-
var ex9 = new AnchorJS({
|
744
|
-
visible: 'always',
|
745
|
-
placement: 'left'
|
746
|
-
});
|
747
|
-
ex9.add('.examples .example:nth-child(9) h3');
|
748
|
-
|
749
|
-
var ex10 = new AnchorJS({
|
750
|
-
visible: 'always',
|
751
|
-
class: 'ajs-10',
|
752
|
-
icon: '\uf0c1'
|
753
|
-
});
|
754
|
-
ex10.add('.examples .example:nth-child(10) h3');
|
755
|
-
|
756
|
-
var ex11 = new AnchorJS({
|
757
|
-
visible: 'always',
|
758
|
-
icon: ''
|
759
|
-
});
|
760
|
-
ex11.add('.examples .example:nth-child(11) h3');
|
761
|
-
|
762
|
-
var ex12 = new AnchorJS({
|
763
|
-
visible: 'always',
|
764
|
-
placement: 'left',
|
765
|
-
icon: ''
|
766
|
-
});
|
767
|
-
ex12.add('.examples .example:nth-child(12) h3');
|
768
|
-
|
769
|
-
var ex13 = new AnchorJS({
|
770
|
-
visible: 'always',
|
771
|
-
placement: 'left',
|
772
|
-
icon: ''
|
773
|
-
});
|
774
|
-
ex13.add('.examples .example:nth-child(13) h3');
|
775
|
-
|
776
|
-
var ex14 = new AnchorJS({
|
777
|
-
visible: 'always',
|
778
|
-
placement: 'left',
|
779
|
-
icon: 'β'
|
780
|
-
});
|
781
|
-
ex14.add('.examples .example:nth-child(14) p');
|
782
|
-
|
783
|
-
var ex15 = new AnchorJS({
|
784
|
-
visible: 'always',
|
785
|
-
class: 'icon-grunticon-link',
|
786
|
-
icon: ''
|
787
|
-
});
|
788
|
-
ex15.add('.examples .example:nth-child(15) h3');
|
789
|
-
|
790
|
-
var hovEx1 = new AnchorJS();
|
791
|
-
hovEx1.add('.hover-examples .example:nth-child(1) h3');
|
792
|
-
|
793
|
-
var hovEx2 = new AnchorJS();
|
794
|
-
hovEx2.add('.hover-examples .example:nth-child(2) h3');
|
795
|
-
|
796
|
-
var hovEx3 = new AnchorJS({ placement: 'left' });
|
797
|
-
hovEx3.add('.hover-examples .example:nth-child(3) h3');
|
798
|
-
|
799
|
-
var hovEx4 = new AnchorJS({ icon: '# LINK' });
|
800
|
-
hovEx4.add('.hover-examples .example:nth-child(4) h3');
|
801
|
-
|
802
|
-
var hovEx5 = new AnchorJS({ icon: 'Permalink' });
|
803
|
-
hovEx5.add('.hover-examples .example:nth-child(5) h3');
|
804
|
-
</script>
|
805
|
-
<script src="//cdn.jsdelivr.net/prism/1.5.1/prism.js"></script>
|
806
|
-
</body>
|
807
|
-
</html>
|