Skip to content

Commit 69d588f

Browse files
authored
1.0.3
1 parent ea50818 commit 69d588f

8 files changed

Lines changed: 566 additions & 310 deletions

File tree

README.md

Lines changed: 63 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,63 @@
1-
# Vanilla JS - Magic Line Navigation
2-
original idea: https://css-tricks.com/jquery-magicline-navigation/
3-
4-
[![CodeFactor](https://www.codefactor.io/repository/github/basticodes/vanilla-js-magic-line-navigation/badge)](https://www.codefactor.io/repository/github/basticodes/vanilla-js-magic-line-navigation)
5-
6-
## Browser Support
7-
![Chrome](https://camo.githubusercontent.com/26846e979600799e9f4273d38bd9e5cb7bb8d6d0/68747470733a2f2f7261772e6769746875622e636f6d2f616c7272612f62726f777365722d6c6f676f732f6d61737465722f7372632f6368726f6d652f6368726f6d655f34387834382e706e67) | ![Firefox](https://camo.githubusercontent.com/6087557f69ec6585eb7f8d7bd7d9ecb6b7f51ba1/68747470733a2f2f7261772e6769746875622e636f6d2f616c7272612f62726f777365722d6c6f676f732f6d61737465722f7372632f66697265666f782f66697265666f785f34387834382e706e67) | ![IE](https://camo.githubusercontent.com/4b062fb12353b0ef8420a72ddc3debf6b2ee5747/68747470733a2f2f7261772e6769746875622e636f6d2f616c7272612f62726f777365722d6c6f676f732f6d61737465722f7372632f617263686976652f696e7465726e65742d6578706c6f7265725f392d31312f696e7465726e65742d6578706c6f7265725f392d31315f34387834382e706e67) | ![Edge](https://camo.githubusercontent.com/826b3030243b09465bf14cf420704344f5eee991/68747470733a2f2f7261772e6769746875622e636f6d2f616c7272612f62726f777365722d6c6f676f732f6d61737465722f7372632f656467652f656467655f34387834382e706e67) | ![Opera](https://camo.githubusercontent.com/96d2405a936da1fb8988db0c1d304d3db04b8a52/68747470733a2f2f7261772e6769746875622e636f6d2f616c7272612f62726f777365722d6c6f676f732f6d61737465722f7372632f6f706572612f6f706572615f34387834382e706e67) | ![Safari](https://camo.githubusercontent.com/6fbaeb334b99e74ddd89190a42766ea3b4600d2c/68747470733a2f2f7261772e6769746875622e636f6d2f616c7272612f62726f777365722d6c6f676f732f6d61737465722f7372632f7361666172692f7361666172695f34387834382e706e67)
8-
--- | --- | --- | --- | --- | --- |
9-
< 15 ✔ | 5+ ✔ | 10+ ✔ | < 15 ✔ | < 23 ✔ | 5.1+ ✔ |
10-
11-
To get IE Support below Version 10 (or any other browser that does not support Element.Classlist) use a Classlist Polyfill.
12-
13-
## Dependencies
14-
* None
15-
16-
However you can implement every Animation Library like anime.js for the animations.
17-
18-
## Usage
19-
```javascript
20-
var myMagicLine = new magicLine(
21-
document.querySelectorAll('.floating-line-menu'),
22-
{
23-
navElements: 'a', // navigation element selector
24-
mode: 'line', // line or pill
25-
lineStrength: 2, // Thickness of the line
26-
lineClass: 'magic-line', // Classname to add to the line element
27-
wrapper: 'div', // the node that's being created as an element wrapper
28-
animationCallback: function (el, params) { // might be either null or a callback function
29-
animationLibrary({
30-
targets: el,
31-
left: params.left,
32-
top: params.top,
33-
width: params.width,
34-
height: params.height
35-
});
36-
}
37-
}
38-
);
39-
myMagicLine.init();
40-
```
41-
42-
## Options
43-
| Option | Value | Default |
44-
| ----------------- |---------------------------------------------------------------|-----------------|
45-
| navElements | a query Selector, you can even define multiple like 'a, span' | 'a' |
46-
| mode | might be either 'line' or 'pill' | 'line' |
47-
| lineStrength | thickness of your line in px | 2 |
48-
| lineClass | The classname of the floating-line element | 'magic-line' |
49-
| wrapper | DOMNode to be inserted as a wrapper | 'div' |
50-
| animationCallback | a callBack Function used for animation | null |
51-
52-
## This is how it looks like
53-
![Alt text](https://raw.githubusercontent.com/basticodes/Vanilla-JS-Magic-Line-Navigation/master/demo/screenshot.PNG)
54-
55-
Check out the [Demo](https://codepen.io/bastian_fiessinger/full/MWYMWJN) on Codepen
1+
# Vanilla JS - Magic Line Navigation
2+
original idea: https://css-tricks.com/jquery-magicline-navigation/
3+
4+
[![CodeFactor](https://www.codefactor.io/repository/github/basticodes/vanilla-js-magic-line-navigation/badge)](https://www.codefactor.io/repository/github/basticodes/vanilla-js-magic-line-navigation)
5+
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
6+
7+
## Browser Support
8+
![Chrome](https://camo.githubusercontent.com/26846e979600799e9f4273d38bd9e5cb7bb8d6d0/68747470733a2f2f7261772e6769746875622e636f6d2f616c7272612f62726f777365722d6c6f676f732f6d61737465722f7372632f6368726f6d652f6368726f6d655f34387834382e706e67) | ![Firefox](https://camo.githubusercontent.com/6087557f69ec6585eb7f8d7bd7d9ecb6b7f51ba1/68747470733a2f2f7261772e6769746875622e636f6d2f616c7272612f62726f777365722d6c6f676f732f6d61737465722f7372632f66697265666f782f66697265666f785f34387834382e706e67) | ![IE](https://camo.githubusercontent.com/4b062fb12353b0ef8420a72ddc3debf6b2ee5747/68747470733a2f2f7261772e6769746875622e636f6d2f616c7272612f62726f777365722d6c6f676f732f6d61737465722f7372632f617263686976652f696e7465726e65742d6578706c6f7265725f392d31312f696e7465726e65742d6578706c6f7265725f392d31315f34387834382e706e67) | ![Edge](https://camo.githubusercontent.com/826b3030243b09465bf14cf420704344f5eee991/68747470733a2f2f7261772e6769746875622e636f6d2f616c7272612f62726f777365722d6c6f676f732f6d61737465722f7372632f656467652f656467655f34387834382e706e67) | ![Opera](https://camo.githubusercontent.com/96d2405a936da1fb8988db0c1d304d3db04b8a52/68747470733a2f2f7261772e6769746875622e636f6d2f616c7272612f62726f777365722d6c6f676f732f6d61737465722f7372632f6f706572612f6f706572615f34387834382e706e67) | ![Safari](https://camo.githubusercontent.com/6fbaeb334b99e74ddd89190a42766ea3b4600d2c/68747470733a2f2f7261772e6769746875622e636f6d2f616c7272612f62726f777365722d6c6f676f732f6d61737465722f7372632f7361666172692f7361666172695f34387834382e706e67)
9+
--- | --- | --- | --- | --- | --- |
10+
< 15 ✔ | 5+ ✔ | 10+ ✔ | < 15 ✔ | < 23 ✔ | 5.1+ ✔ |
11+
12+
To get IE Support below Version 10 (or any other browser that does not support Element.Classlist) use a Classlist Polyfill.
13+
14+
## Dependencies
15+
* None
16+
17+
However you can implement every Animation Library like anime.js for the animations.
18+
19+
## Filesize
20+
* Minified Version:
21+
* 2.58 KB (1.07 KB gzipped)
22+
23+
* Non Minified Version
24+
* 7.49 KB (2.12 KB gzipped)
25+
26+
## Usage
27+
```javascript
28+
var myMagicLine = new magicLine(
29+
document.querySelectorAll('.floating-line-menu'),
30+
{
31+
navElements: 'a', // navigation element selector
32+
mode: 'line', // line or pill
33+
lineStrength: 2, // Thickness of the line
34+
lineClass: 'magic-line', // Classname to add to the line element
35+
wrapper: 'div', // the node that's being created as an element wrapper
36+
animationCallback: function (el, params) { // might be either null or a callback function
37+
animationLibrary({
38+
targets: el,
39+
left: params.left,
40+
top: params.top,
41+
width: params.width,
42+
height: params.height
43+
});
44+
}
45+
}
46+
);
47+
myMagicLine.init();
48+
```
49+
50+
## Options
51+
| Option | Value | Default |
52+
| ----------------- |---------------------------------------------------------------|-----------------|
53+
| navElements | a query Selector, you can even define multiple like 'a, span' | 'a' |
54+
| mode | might be either 'line' or 'pill' | 'line' |
55+
| lineStrength | thickness of your line in px | 2 |
56+
| lineClass | The classname of the floating-line element | 'magic-line' |
57+
| wrapper | DOMNode to be inserted as a wrapper | 'div' |
58+
| animationCallback | a callBack Function used for animation | null |
59+
60+
## This is how it looks like
61+
![Alt text](https://raw.githubusercontent.com/basticodes/Vanilla-JS-Magic-Line-Navigation/master/demo/screenshot.PNG)
62+
63+
Check out the [Demo](https://codepen.io/bastian_fiessinger/full/MWYMWJN) on Codepen

changelog.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
# Changelog
22

3+
### 1.0.3
4+
* Improve all comments to make them better understandable
5+
* replaced 'rollup-plugin-uglify' with 'rollup-plugin-terser' for minification
6+
* Used Prettier to beautify the non minified version of magicline.js
7+
* Updated README.md
8+
39
### 1.0.2
410
* Automatically add an active class to the first element when no active element was specified
511

6-
### 1,0.1
12+
### 1.0.1
713
* Fixed a naming issue
814

915
### 1.0.0

0 commit comments

Comments
 (0)