{"id":18939139,"url":"https://github.com/darmikon/visi","last_synced_at":"2026-03-11T01:01:42.986Z","repository":{"id":57392918,"uuid":"55136754","full_name":"Darmikon/visi","owner":"Darmikon","description":"Small js library to assign events when html element becomes visible in viewport","archived":false,"fork":false,"pushed_at":"2016-04-02T21:25:13.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-13T01:37:08.986Z","etag":null,"topics":["events","javascript-events","visi","visibility-event"],"latest_commit_sha":null,"homepage":"http://visi.mana.pro/","language":"HTML","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/Darmikon.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":"2016-03-31T09:14:53.000Z","updated_at":"2017-07-02T14:52:34.000Z","dependencies_parsed_at":"2022-08-31T09:42:16.989Z","dependency_job_id":null,"html_url":"https://github.com/Darmikon/visi","commit_stats":null,"previous_names":["hellfrom/visi"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Darmikon/visi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Darmikon%2Fvisi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Darmikon%2Fvisi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Darmikon%2Fvisi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Darmikon%2Fvisi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Darmikon","download_url":"https://codeload.github.com/Darmikon/visi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Darmikon%2Fvisi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29587066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T16:55:40.614Z","status":"ssl_error","status_checked_at":"2026-02-18T16:55:37.558Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["events","javascript-events","visi","visibility-event"],"created_at":"2024-11-08T12:16:30.696Z","updated_at":"2026-02-18T17:01:20.856Z","avatar_url":"https://github.com/Darmikon.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Visi.js ##\n\n### Description ###\nVisi.js is a small library written on vanilla.js. \nIt doesn't require any dependencies.\nVisi.js provides functionality to monitor when dom element is partially in a viewport\nIt adds some methods to simplify your work with handling of such event.\n\n### Demo ###\n[Visi + animation](http://visi.mana.pro/ \"Visi.js\")\n\n[Visi on jsfiddler](https://jsfiddle.net/Hellfrom/ksn8je0o/ \"Visi on jsfiddler\") (Watch console)\n\n### Installation ###\n\n1. Remote\n\n\t```\n\t\u003cscript type=\"text/javascript\" \n\t\tsrc=\"https://cdn.rawgit.com/hellfrom/visi/master/visi.min.js\"\n\t\u003e\u003c/script\u003e\n\t```\n2. npm\n\t```\n\tnpm install visi\n\t```\n3. bower\n\t```\n\tbower install visi\n\t```  \n\n### How to use ###\nEvent names\n`visible` and `hidden`\n\nShort api\n- add\n```\n.add(domElements); //single or multiple dom elements\n```\n\nShort api\n- add\n```\n.add(domElements); //single or multiple dom elements\n```\n- on\n```\n.on(eventName,function(changedElement,off){\n\t//off() removes event listeners from fired element\n});\n```\n- once (unregisters all events from fired element after first triggering)\n```\n.once(eventName,function(changedElement){\n\t//...\n});\n```\n- off\n```\nvar visi = Visi.add(/*dom elements*/);\nvisi.off();\t//remove all event listeners from selection\n```\n- getOff\n```\nvar off = Visi.add(dom)\n\t.on('visible',callback)\n\t.getOff();\noff(); //remove all listeners from selection\n```\n\n\n\nHTML\n```\n\u003cdiv class = \"p1\"\n\t id = \"id1\"\u003e\n\tLorem...\n\u003c/div\u003e\n\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\n\u003cdiv class = \"p2\"\n\t id = \"id2\"\u003e\n\tLorem ipsum...\n\u003c/div\u003e\n\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\u003cbr/\u003e\n\u003cdiv class = \"p3 p1\"\u003e\n\tLorem ipsum dolor...\n\u003c/div\u003e\n```\n\nJS\n```\nvar visi = Visi.add(document.getElementById('id1'))\n\t.on('visible',function(){\n\t\tconsole.log('visible id1');\n\t});\n\nvisi.off();\n```\n\nAdd event to the same instance again\n```\nvisi.on('visible',function(){\n\tconsole.log('visible again');\n});\n\n```\n\nAdd event only once - after first triggering it will automatically unregister\nall event listeners\n```\nVisi.add(document.getElementById('id1')).once('hidden',function(element,off){\n\t//off() is not necessary for this use case\n\t//...\n});\n\n```\n\nListen if element becomes hidden every time with ```.on```\n```\nVisi.add(document.querySelectorAll('.p1'))\n\t.on('hidden',function(element,off){\n\t\tconsole.log('hidden id1',element);\n\t\tconsole.log(arguments);\n\t\t\n\t\t//unregister listeners only for element which\n\t\t//became hidden after some scrolling etc.\n\t\toff();\n\t});\n```\n\nGet unregisters\n```\nvar off = Visi.add(document.getElementById('id1'))\n\t.on('visible',function(){\n\t\tconsole.log('visible id1');\n\t}).getOff();\n\n//remove all events from all dom elements for current selection\noff();\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarmikon%2Fvisi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarmikon%2Fvisi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarmikon%2Fvisi/lists"}