{"id":23081139,"url":"https://github.com/unfold/spot","last_synced_at":"2025-08-23T19:20:03.544Z","repository":{"id":22594545,"uuid":"25936521","full_name":"unfold/spot","owner":"unfold","description":"A performance optimized event plugin to track when an element is within the viewport or in proximity of it.","archived":false,"fork":false,"pushed_at":"2014-10-29T19:00:56.000Z","size":104,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-09T02:44:41.369Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unfold.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-29T19:00:34.000Z","updated_at":"2014-10-29T19:00:56.000Z","dependencies_parsed_at":"2022-08-20T20:50:47.587Z","dependency_job_id":null,"html_url":"https://github.com/unfold/spot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unfold%2Fspot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unfold%2Fspot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unfold%2Fspot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unfold%2Fspot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unfold","download_url":"https://codeload.github.com/unfold/spot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247014521,"owners_count":20869376,"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":[],"created_at":"2024-12-16T13:47:57.608Z","updated_at":"2025-04-03T14:15:07.439Z","avatar_url":"https://github.com/unfold.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jQuery Spot.js\nA performance optimized event plugin to track when an element is within the viewport or in proximity of it.\n\n## Why?\nIt's a common practice to bind a tracking function to the scroll event to get the position of the viewport and it's relation to tracked elements. A drawback to this technique is this forces the browser to execute your code no matter what, resulting in jag and studder in the scroll flow.\n\nSpot uses requestAnimationFrame which tries to fire 60 times per second, which the browser only fires when it think it has the capacity.\n\n## API\n``` javascript\n\n  $(element).enterscreen(callback, options)\n  $(element).leavescreen(callback, options)\n  $(element).onscreen(callback, options)\n\n  $(element).spot('onscreen', function(event) {\n    …\n  }, {\n    proximity: 200,\n    triggerOnce: true\n  })\n```\n\n## Options\n__proximity:__\nOffsets the trigger area both above and below of the element\n\n__triggerOnce:__\nIf set to true, the callback will only be called once in it's lifetime\n\n\n## Event properties\n__screenTop:__\nReturns offset from the top of the element and the viewport.\n\n__elementHeight:__\nreturns the height of the element which the event was attached.\n\n__direction:__\nReturn the direction the scroll which is either up or down.\n\n__visible:__\nReturns if the element is visible on the screen. This could be useful if proximity is so large the event fires without the element visible.\n\n__aboveViewport:__\nReturns if the element is above the viewport. This could be useful if proximity is so large the event fires without the element visible.\n\n__belowViewport:__\nSame as above.\n\n__element:__\nReturns the element which the event was attached.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funfold%2Fspot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funfold%2Fspot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funfold%2Fspot/lists"}