├── .eslintignore ├── .gitignore ├── CHANGELOG.md ├── .prettierrc.json ├── .npmignore ├── tsconfig.json ├── vite.config.ts ├── .github └── workflows │ ├── pullRequest.yml │ └── releaseCreated.yml ├── .eslintrc.json ├── LICENSE ├── package.json ├── README.md └── src └── index.ts /.eslintignore: -------------------------------------------------------------------------------- 1 | /dist -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/node_modules 2 | .idea 3 | .DS_Store 4 | .vscode 5 | /dist 6 | 7 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [1.0.7] - 2018-7-24 2 | 3 | ### Added 4 | 5 | - Gyro support 6 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "tabWidth": 2, 4 | "semi": true, 5 | "singleQuote": true, 6 | "printWidth": 80 7 | 8 | } 9 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | .husky 3 | .vscode 4 | src 5 | .eslintrc.json 6 | prettierrc.json 7 | tsconfig.json 8 | vite.config.ts 9 | .github 10 | .eslintignore 11 | .prettierrc.json 12 | CHANGELOG.md -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "noImplicitAny": true, 4 | "outDir": "dist/types", 5 | "module": "esnext", 6 | "target": "es5", 7 | "sourceMap": true, 8 | "declaration": true, 9 | "emitDeclarationOnly": true, 10 | "lib": ["es2018", "dom"], 11 | "moduleResolution": "node" 12 | }, 13 | "include": ["src/index.ts"], 14 | "exclude": ["src/lib/**/tests"], 15 | } 16 | -------------------------------------------------------------------------------- /vite.config.ts: -------------------------------------------------------------------------------- 1 | import { resolve } from 'path'; 2 | import { defineConfig } from 'vite'; 3 | import dts from 'vite-plugin-dts'; 4 | // https://vitejs.dev/guide/build.html#library-mode 5 | export default defineConfig({ 6 | build: { 7 | lib: { 8 | entry: resolve(__dirname, 'src/index.ts'), 9 | name: 'ParallaxContent', 10 | fileName: 'parallaxContent', 11 | }, 12 | }, 13 | plugins: [dts()], 14 | }); 15 | -------------------------------------------------------------------------------- /.github/workflows/pullRequest.yml: -------------------------------------------------------------------------------- 1 | name: pull-request 2 | on: 3 | pull_request: 4 | branches: 5 | - 'master' 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Check out code 11 | uses: actions/checkout@v4 12 | - name: Set up node 13 | uses: actions/setup-node@v3 14 | - name: Install dependencies 15 | run: npm install 16 | - name: Run linter 17 | run: npm run lint 18 | - name: Run build 19 | run: npm run build -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "@typescript-eslint/parser", 3 | "parserOptions": { 4 | "ecmaVersion": 6, 5 | "sourceType": "module", 6 | "ecmaFeatures": { 7 | "modules": true, 8 | "experimentalObjectRestSpread": true 9 | } 10 | }, 11 | "plugins": ["@typescript-eslint", "prettier"], 12 | "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], 13 | "rules": { 14 | "prettier/prettier": 1, 15 | "no-unused-vars": 0, 16 | "@typescript-eslint/no-unused-vars": ["error"], 17 | "@typescript-eslint/no-this-alias": 0 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.github/workflows/releaseCreated.yml: -------------------------------------------------------------------------------- 1 | name: Publish Package to npmjs 2 | on: 3 | release: 4 | types: [created] 5 | jobs: 6 | build-and-publish: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Check out code 10 | uses: actions/checkout@v4 11 | - name: Set up node 12 | uses: actions/setup-node@v3 13 | with: 14 | node-version: '16.x' 15 | registry-url: 'https://registry.npmjs.org' 16 | - name: Install dependencies 17 | run: npm ci 18 | - name: Run liter 19 | run: npm run lint 20 | - name: Deploy 21 | run: | 22 | npm run build 23 | npm publish --access public 24 | env: 25 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Illia Liemiehov 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 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "parallax_content", 3 | "version": "2.0.1", 4 | "description": "VanillaJS parallax content plugin", 5 | "types": "./dist/index.d.ts", 6 | "main": "./dist/parallaxContent.umd.js", 7 | "module": "./dist/parallaxContent.mjs", 8 | "exports": { 9 | ".": { 10 | "types": "./dist/index.d.ts", 11 | "import": "./dist/parallaxContent.mjs", 12 | "require": "./dist/parallaxContent.umd.js" 13 | } 14 | }, 15 | "devDependencies": { 16 | "@lemehovskiy/scroller": "^0.2.7", 17 | "@types/jquery": "^3.5.29", 18 | "@types/node": "^20.10.4", 19 | "@typescript-eslint/eslint-plugin": "^6.13.2", 20 | "@typescript-eslint/parser": "^6.13.2", 21 | "eslint": "^8.55.0", 22 | "eslint-plugin-prettier": "^5.0.1", 23 | "husky": "^8.0.3", 24 | "lint-staged": "^15.2.0", 25 | "prettier": "^3.1.0", 26 | "typescript": "^5.3.3", 27 | "vite": "^5.0.6", 28 | "vite-plugin-dts": "^3.6.4" 29 | }, 30 | "peerDependencies": { 31 | "gsap": "^3.12.4" 32 | }, 33 | "scripts": { 34 | "build": "tsc && vite build", 35 | "lint": "npm run lint:eslint && npm run lint:prettier", 36 | "lint:eslint": "eslint src/ --ext .ts --max-warnings=0", 37 | "lint:prettier": "prettier 'src/**/*.ts' --check", 38 | "fix": "npm run fix:prettier && npm run fix:eslint", 39 | "fix:eslint": "eslint src/ --ext .ts --fix --max-warnings=0", 40 | "fix:prettier": "prettier 'src/**/*.ts' --write", 41 | "prepare": "husky install" 42 | }, 43 | "keywords": [ 44 | "parallax", 45 | "gsap", 46 | "greensock", 47 | "parallax scroll", 48 | "plugin", 49 | "animation" 50 | ], 51 | "repository": { 52 | "type": "git", 53 | "url": "https://github.com/lemehovskiy/parallax-content" 54 | }, 55 | "author": "lemehovskiy", 56 | "license": "ISC" 57 | } 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## parallax-content 2 | 3 | Create captivating parallax contents effortlessly with the ParallaxContent plugin. This lightweight Vanilla JavaScript plugin, powered by GSAP animation, supports Scroll and Gyroscope events. 4 | 5 | Features: 6 | 7 | * Vanilla JavaScript and GSAP powered 8 | * Scroll, Gyroscope events 9 | * Customizable shift and animation duration 10 | 11 | ### Demo 12 | 13 | [Basic demo](https://codesandbox.io/p/devbox/parallax-content-basic-demo-pk4crm) 14 | 15 | ### Package Managers 16 | 17 | ```sh 18 | # NPM 19 | npm install parallax_content 20 | ``` 21 | 22 | ### Installation 23 | 24 | #### Include js 25 | 26 | ```html 27 | 28 | 29 | ``` 30 | 31 | #### Set HTML 32 | 33 | ```html 34 |