{"id":17036011,"url":"https://github.com/phucbm/cursorjs","last_synced_at":"2025-04-12T13:02:09.241Z","repository":{"id":40567367,"uuid":"450118357","full_name":"phucbm/cursorjs","owner":"phucbm","description":"🦄  Create custom mouse cursor with pure vanilla JS (4kb) and CSS (optional) with no dependency.","archived":false,"fork":false,"pushed_at":"2023-07-06T11:19:33.000Z","size":382,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T05:46:29.628Z","etag":null,"topics":["cursor"],"latest_commit_sha":null,"homepage":"https://cursorjs.netlify.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phucbm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-01-20T13:57:00.000Z","updated_at":"2025-03-18T06:07:58.000Z","dependencies_parsed_at":"2025-04-12T13:01:29.927Z","dependency_job_id":null,"html_url":"https://github.com/phucbm/cursorjs","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":"phucbm/gulp-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phucbm%2Fcursorjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phucbm%2Fcursorjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phucbm%2Fcursorjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phucbm%2Fcursorjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phucbm","download_url":"https://codeload.github.com/phucbm/cursorjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248571893,"owners_count":21126522,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cursor"],"created_at":"2024-10-14T08:48:55.990Z","updated_at":"2025-04-12T13:02:09.171Z","avatar_url":"https://github.com/phucbm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🦄 Cursor.js\n\n\u003e Create custom mouse cursor with pure vanilla JS (4kb) and CSS (optional) with no dependency.\n\n[![npm-version](https://badgen.net/npm/v/%40phucbm%2Fcursorjs?cache=600)](https://www.npmjs.com/package/%40phucbm%2Fcursorjs)\n[![total-download](https://badgen.net/npm/dt/%40phucbm%2Fcursorjs?cache=600)](https://www.npmjs.com/package/%40phucbm%2Fcursorjs)\n[![Made in Vietnam](https://raw.githubusercontent.com/webuild-community/badge/master/svg/made.svg)](https://webuild.community)\n[![jsdelivr](https://data.jsdelivr.com/v1/package/gh/phucbm/cursorjs/badge?style=rounded)](https://www.jsdelivr.com/package/gh/phucbm/cursorjs)\n[![license](https://badgen.net/github/license/phucbm/cursorjs/)](https://github.com/phucbm/cursorjs/blob/main/LICENSE)\n[![Netlify Status](https://api.netlify.com/api/v1/badges/9d9b7120-8c9d-486d-b53e-7fa938ce5c78/deploy-status)](https://app.netlify.com/sites/cursorjs/deploys)\n\nKey features:\n\n- Cursor moving with easing (no dependencies)\n- Extremely light-weight (4kb)\n- One cursor - unlimited styles on hover\n\nDemo 👉 https://cursorjs.netlify.app\n\n## Getting started\n\n### Installation\n\n#### NPM Package\n\n```shell\nnpm i @phucbm/cursorjs\n```\n\nImport\n\n```js\nimport \"@phucbm/cursorjs\";\n```\n\n#### Download\n\n👉 Self hosted - [Download the latest release](https://github.com/phucbm/cursorjs/releases/latest)\n\n```html\n\n\u003cscript src=\"./cursorjs.min.js\"\u003e\u003c/script\u003e\n```\n\n👉 CDN Hosted - [jsDelivr](https://www.jsdelivr.com/package/gh/phucbm/cursorjs)\n\n```html\n\u003c!-- JS (10KB) --\u003e\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/phucbm/cursorjs@latest/dist/cursorjs.min.js\"\u003e\u003c/script\u003e\n```\n\n### Initialize\n\n```js\n// with default style\nCursorjs.create();\n\n// with more options\nCursorjs.create({\n    id: 'my-cursor',\n    innerHTML: '\u003ci class=\"icon-cursor\"\u003e\u003c/i\u003e',\n    hover: [\n        {\n            selectors: '.items',\n            className: 'my-style-class'\n        },\n    ]\n});\n```\n\n## Docs\n\n### Cursor options\n\n| Name             | Type        | Default                   | Description                                                      |\n|------------------|-------------|---------------------------|------------------------------------------------------------------|\n| id               | string      | `\"css-cursor-\u003cuniqueID\u003e\"` | Set ID to get instance                                           |\n| speed            | float       | `0.2`                     | Cursor easing speed, the smaller, the slower                     |\n| container        | DOM element | `document.body`           | Where to append cursor HTML                                      |\n| className        | string      | `\"\"`                      | Class for cursor                                                 |\n| innerHTML        | string      | `\"\"`                      | Inner HTML for cursor                                            |\n| classInViewport  | string      | `\"\"`                      | Class when cursor is in viewport                                 |\n| matchMedia       | string      | `\"(hover:hover)\"`         | Only init if match this media                                    |\n| hoverPrefixClass | string      | `\"\"`                      | Prefix for hover class.                                          |\n| hover            | string      | `[]`                      | Actions when hover on specific elements. See Hover object below. |\n| wrapperCSS       | CSS object  | `{...}`                   | Default style for cursor wrapper (*)                             |\n| cursorCSS        | CSS object  | `{...}`                   | Default style for cursor (*)                                     |\n\n(*) default CSS\n\n```js\nconst options = {\n    wrapperCSS: {\n        pointerEvents: 'none',\n        zIndex: '9999',\n        position: 'fixed',\n        top: 0,\n        left: 0,\n    },\n    cursorCSS: {\n        boxShadow: '0 0 0 2px rgba(0, 0, 0, .3)',\n        width: '40px',\n        height: '40px',\n        borderRadius: '50%',\n        transition: 'all .3s ease',\n        position: 'absolute',\n        transform: 'translate(-50%,-50%)'\n    }\n}\n```\n\n### Hover object\n\n| Name      | Type   | Default  | Description                                      |\n|-----------|--------|----------|--------------------------------------------------|\n| selectors | string | `\"\"`     | CSS selector, multiple elements is supported     |\n| className | string | `\"\"`     | Add this class to cursor when hover on selectors |\n| cursor    | string | `\"none\"` | CSS cursor when hover on selectors               |\n\n```js\n// sample hover array\nconst options = {\n    hover: [\n        {\n            selectors: '.item-a, .item-b',\n            className: 'is-hover-on-items',\n            cursor: 'pointer',\n        },\n        {\n            selectors: '.item-c',\n            className: 'is-hover-on-item-c',\n            cursor: 'none',\n        }\n    ]\n}\n```\n\n## Methods\n\n```js\nconst cursor = Cursorjs.get('my-cursor');\n\n// remove cursor from DOM\ncursor.destroy();\n\n// check new hover selectors, useful when new items are loaded via AJAX\ncursor.refresh();\n```\n\n## Deployment\n\n```shell\n# Run dev server\nnpm run dev\n\n# Generate UMD and module version\nnpm run prod\n\n# Build production site\nnpm run build\n\n# Generate UMD and module version then publish NPM package\nnpm run publish\n```\n\n## License\n\n[MIT License](https://github.com/phucbm/cursorjs/blob/main/LICENSE)\n\nCopyright (c) 2023 @phucbm","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphucbm%2Fcursorjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphucbm%2Fcursorjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphucbm%2Fcursorjs/lists"}