{"id":20285830,"url":"https://github.com/tpkn/viewability","last_synced_at":"2026-02-19T10:33:01.582Z","repository":{"id":74204181,"uuid":"143777871","full_name":"tpkn/viewability","owner":"tpkn","description":"Calculate DOM element viewability","archived":false,"fork":false,"pushed_at":"2018-08-13T21:09:26.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T11:56:11.135Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","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/tpkn.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}},"created_at":"2018-08-06T20:10:58.000Z","updated_at":"2020-09-25T19:16:40.000Z","dependencies_parsed_at":"2023-02-27T06:15:42.647Z","dependency_job_id":null,"html_url":"https://github.com/tpkn/viewability","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tpkn/viewability","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpkn%2Fviewability","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpkn%2Fviewability/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpkn%2Fviewability/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpkn%2Fviewability/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpkn","download_url":"https://codeload.github.com/tpkn/viewability/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpkn%2Fviewability/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29609850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":[],"created_at":"2024-11-14T14:29:07.810Z","updated_at":"2026-02-19T10:33:01.553Z","avatar_url":"https://github.com/tpkn.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Viewability   \nCalculate DOM element viewability\n\n\n\n\n## API\n\n### Viewability(stage, element[, options])\n\n### stage   \n**Type**: _Object_  \n`document.documentElement` or `window` object.\n\n\n### element  \n**Type**: _Object_  \nDOM element\n\n\n### options.percentage\n**Type**: _Number_   \n**Default**: : `50`  \nVisibility of the block in percentage after which the callback will be triggered.\n\n\n### options.iab\n**Type**: _Boolean_  \n**Default**: `false`  \nThe callback function will be triggered when block has 50% viewability for 1 second. `percentage` option overrides standard (50%) value.\n\n\n### .check()\n**Type**: _Function_  \n**Returns**: `Object`  \nReturned object contains `{ x, y, square }` params, where `x` and `y` are the vertical and horizontal viewability (just incase only one axis needed), and `square` is the visible square area.\n\n\n\n\n\n## Usage\n```javascript\nvar va;\nvar stage = document.documentElement\nvar element = document.getElementById('block');\n\nvar viewability = new Viewability(stage, element, {\n   iab: true, \n   percentage: 22,\n   on_visible: onVisible\n});\n\nwindow.onscroll = window.onresize = checkViewability;\ncheckViewability();\n\n\nfunction onVisible(){\n   console.log('On visible');\n}\n\nfunction checkViewability(){\n   va = viewability.check();\n   console.log(va.x, va.y, va.square);\n}\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpkn%2Fviewability","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpkn%2Fviewability","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpkn%2Fviewability/lists"}