{"id":22367819,"url":"https://github.com/mystroken/mouse-explorer","last_synced_at":"2025-08-25T18:40:10.190Z","repository":{"id":57128992,"uuid":"242139369","full_name":"mystroken/mouse-explorer","owner":"mystroken","description":":mouse2: Browse along a section clipped into a viewport using a mouse.","archived":false,"fork":false,"pushed_at":"2020-02-23T13:45:15.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-02T05:32:10.509Z","etag":null,"topics":["interaction","mouse","mousemove","sliding"],"latest_commit_sha":null,"homepage":"","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/mystroken.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}},"created_at":"2020-02-21T12:56:02.000Z","updated_at":"2022-05-08T09:58:02.000Z","dependencies_parsed_at":"2022-08-31T18:33:46.803Z","dependency_job_id":null,"html_url":"https://github.com/mystroken/mouse-explorer","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mystroken%2Fmouse-explorer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mystroken%2Fmouse-explorer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mystroken%2Fmouse-explorer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mystroken%2Fmouse-explorer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mystroken","download_url":"https://codeload.github.com/mystroken/mouse-explorer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245689500,"owners_count":20656416,"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":["interaction","mouse","mousemove","sliding"],"created_at":"2024-12-04T18:21:29.813Z","updated_at":"2025-03-26T15:53:24.609Z","avatar_url":"https://github.com/mystroken.png","language":"JavaScript","readme":"# :mouse2: mouse-explorer\n\n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/mystroken/mouse-explorer/issues)\n\n\u003cblockquote\u003e\nBrowse along a section clipped into a viewport using a mouse.\n\u003cbr\u003e\nVanilla Js - No dependencies - ~987B minified and gzipped\n\u003c/blockquote\u003e\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Installation\n\n```bash\nnpm install @mystroken/mouse-explorer\n```\n\n## Usage\n\nLook at the sources files for more information.\n\n```javascript\nimport createMouseExplorer from '@mystroken/mouse-explorer';\n\nconst viewport = document.querySelector('#viewport');\nconst section = document.querySelector('#container');\nconst explorer = createMouseExplorer({ viewport, section });\n\nexplorer.on(({ x, y }) =\u003e {\n    section.style.transform = `translate3d(${x},${y},0)`;\n});\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Parameters\n\n```javascript\nconst explorer = createMouseExplorer({\n    ease: 0.21,\n    viewport: document.querySelector('#viewport'),\n    section: document.querySelector('#container'),\n    center: true,\n});\n```\n\n\u003cbr\u003e\n\n#### viewport\n\nDetermines the viewport that clips the section.\n\n| Default  | Type          | Required |\n| -------- | ------------- | -------- |\n| `Window` | `HTMLElement` | **No**   |\n\n\u003cbr\u003e\n\n#### section\n\nDetermines the section to be explored.\n\n| Default | Type          | Required |\n| ------- | ------------- | -------- |\n| `null`  | `HTMLElement` | **Yes**  |\n\n\u003cbr\u003e\n\n#### ease\n\nSet the ease of movement (section moving inside the viewport).\n\n| Default | Type     | Required |\n| ------- | -------- | -------- |\n| `0.21`  | `Number` | **No**   |\n\n\u003cbr\u003e\n\n#### center\n\nTells the explorer to center or not the section on start.\n\n| Default | Type      | Required |\n| ------- | --------- | -------- |\n| `false` | `Boolean` | **No**   |\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Methods\n\n#### on(callback)\nAdd a callback to be called on each mouse move on the section.\n\n\u003cbr\u003e\n\n#### off(callback)\nRemove a callback.\n\n\u003cbr\u003e\n\n#### positionAt(x, y)\nGet position (in pixel) for a given [-1,1] coordinates.\n\n| Argument | Types    | Info                                  | Required |\n| -------- | -------- | ------------------------------------- | -------- |\n| x        | `Number` | The given x-axis position (in pixel). | Yes      |\n| y        | `Number` | The given y-axis position (in pixel). | Yes      |\n\n```javascript\nconst explorer = createMouseExplorer({ viewport, section });\n\n// Position at center\nexplorer.positionAt(0, 0);\n// Returns corresponding \n// amount of pixels to slide in order \n// to place the section in \n// the middle of the viewport.\n// { x: 284, y: 97 }\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmystroken%2Fmouse-explorer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmystroken%2Fmouse-explorer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmystroken%2Fmouse-explorer/lists"}