├── .eslintrc.js
├── .github
└── workflows
│ └── npm-publish.yml
├── .gitignore
├── LICENSE
├── README.md
├── builds
├── cdn.js
└── module.js
├── docs
├── index.html
├── using-css-animations.html
├── using-css-transitions.html
└── using-tailwindcss.html
├── package.json
├── scripts
└── build.js
└── src
└── index.js
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | "env": {
3 | "node": true,
4 | "browser": true,
5 | "es6": true,
6 | },
7 | "extends": "eslint:recommended",
8 | "parserOptions": {
9 | "ecmaVersion": 9,
10 | "sourceType": "module",
11 | "allowImportExportEverywhere": true
12 | },
13 | "rules": {
14 | "linebreak-style": [
15 | "error",
16 | "unix"
17 | ],
18 | "quotes": [
19 | "error",
20 | "single"
21 | ],
22 | "semi": [
23 | "error",
24 | "never"
25 | ],
26 | "space-in-parens": [
27 | "error",
28 | "never"
29 | ],
30 | "no-template-curly-in-string": [
31 | "error"
32 | ],
33 | "block-scoped-var": [
34 | "error"
35 | ],
36 | "no-empty-function": [
37 | "error"
38 | ],
39 | "brace-style": [
40 | "error",
41 | "1tbs"
42 | ],
43 | "camelcase": [
44 | "error"
45 | ],
46 | "comma-spacing": [
47 | "error",
48 | {
49 | "before": false,
50 | "after": true
51 | }
52 | ],
53 | "comma-style": [
54 | "error",
55 | "last"
56 | ],
57 | "computed-property-spacing": [
58 | "error",
59 | "never"
60 | ],
61 | "eol-last": [
62 | "error",
63 | "always"
64 | ],
65 | "func-call-spacing": [
66 | "error",
67 | "never"
68 | ],
69 | "key-spacing": [
70 | "error",
71 | {
72 | "mode": "minimum",
73 | "beforeColon": false,
74 | "afterColon": true
75 | }
76 | ],
77 | "keyword-spacing": [
78 | "error",
79 | {
80 | "before": true,
81 | "after": true
82 | }
83 | ],
84 | "lines-between-class-members": [
85 | "error",
86 | "always"
87 | ],
88 | "no-array-constructor": [
89 | "error"
90 | ],
91 | "no-console": [
92 | "warn"
93 | ],
94 | "no-multiple-empty-lines": [
95 | "error",
96 | {
97 | "max": 2
98 | }
99 | ],
100 | "no-trailing-spaces": [
101 | "error"
102 | ],
103 | "no-unused-vars": [
104 | "error",
105 | {
106 | "ignoreRestSiblings": true
107 | }
108 | ],
109 | "one-var": [
110 | "error",
111 | "never"
112 | ],
113 | "padded-blocks": [
114 | "error",
115 | "never"
116 | ],
117 | "padding-line-between-statements": [
118 | "error",
119 | {
120 | "blankLine": "always",
121 | "prev": "*",
122 | "next": "return"
123 | }
124 | ],
125 | "prefer-object-spread": [
126 | "error"
127 | ],
128 | "no-fallthrough": "off",
129 | "no-var": [
130 | "error"
131 | ],
132 | "object-shorthand": [
133 | "error"
134 | ],
135 | "prefer-destructuring": [
136 | "error"
137 | ],
138 | "prefer-rest-params": [
139 | "error"
140 | ],
141 | "prefer-spread": [
142 | "error"
143 | ]
144 | }
145 | };
146 |
--------------------------------------------------------------------------------
/.github/workflows/npm-publish.yml:
--------------------------------------------------------------------------------
1 | name: NPM Publish
2 |
3 | on:
4 | release:
5 | types: [created]
6 |
7 | jobs:
8 | publish:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v3
12 | - uses: actions/setup-node@v3
13 | with:
14 | node-version: '20.x'
15 | registry-url: 'https://registry.npmjs.org'
16 | - run: npm install
17 | - run: npm run build
18 | - run: npm version --no-git-tag-version ${{ github.event.release.tag_name }}
19 | - run: npm publish
20 | env:
21 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | dist
2 | node_modules
3 | package-lock.json
4 | yarn.lock
5 | .DS_*
6 | .env
7 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Lars Heidkämper
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Alpine.js Intersect-Class Plugin
2 |
3 | An Alpine.js plugin to easily set CSS classes to an element when it enters the viewport.
4 | Especially useful for animating elements when scrolling.
5 |
6 | ```html
7 |
8 |
The README is there for you!
31 | 32 |
74 | This demo shows the Intersect-Class plugin in combination with CSS Animations.
75 | Demos for CSS Transitions and Tailwind CSS are also available.
76 |
56 | This demo shows the Intersect-Class plugin in combination with CSS Transitions.
57 | Demos for CSS Animations and Tailwind CSS are also available.
58 |
15 | This demo shows the Intersect-Class plugin in combination with Tailwind CSS.
16 | Demos for vanilla CSS Transitions and CSS Animations are also available.
17 |