{"id":17793677,"url":"https://github.com/andyexeter/most-visible","last_synced_at":"2025-07-10T06:37:30.717Z","repository":{"id":48681455,"uuid":"69260548","full_name":"andyexeter/most-visible","owner":"andyexeter","description":"A zero dependency JavaScript module and jQuery plugin which returns the most visible element from a given set","archived":false,"fork":false,"pushed_at":"2023-11-04T12:29:38.000Z","size":525,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-27T12:45:28.099Z","etag":null,"topics":["javascript","jquery","npm-module","visibility"],"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/andyexeter.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","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":"2016-09-26T14:48:32.000Z","updated_at":"2023-11-04T14:38:07.000Z","dependencies_parsed_at":"2022-08-29T05:40:30.683Z","dependency_job_id":"7d18d683-c368-4e8e-9e13-13585d959508","html_url":"https://github.com/andyexeter/most-visible","commit_stats":{"total_commits":143,"total_committers":2,"mean_commits":71.5,"dds":0.04195804195804198,"last_synced_commit":"db74e98188f62f7134c877caacc982954e4b3027"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyexeter%2Fmost-visible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyexeter%2Fmost-visible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyexeter%2Fmost-visible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyexeter%2Fmost-visible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andyexeter","download_url":"https://codeload.github.com/andyexeter/most-visible/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243719372,"owners_count":20336598,"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":["javascript","jquery","npm-module","visibility"],"created_at":"2024-10-27T11:12:01.590Z","updated_at":"2025-03-16T19:33:04.679Z","avatar_url":"https://github.com/andyexeter.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Most Visible\n\n[![License](https://img.shields.io/npm/l/most-visible)](https://github.com/andyexeter/most-visible/blob/master/LICENSE)\n[![Build status](https://github.com/andyexeter/most-visible/actions/workflows/ci.yaml/badge.svg)](https://github.com/andyexeter/most-visible/actions/workflows/ci.yaml)\n[![npm version](https://img.shields.io/npm/v/most-visible.svg)](https://www.npmjs.com/package/most-visible)\n[![Size](https://img.shields.io/bundlephobia/min/most-visible@2.0.0)](https://unpkg.com/most-visible@2.0.0/dist/most-visible.min.js)\n[![Size](https://img.shields.io/bundlephobia/minzip/most-visible@2.0.0)](https://unpkg.com/most-visible@2.0.0/dist/most-visible.min.js)\n\nA zero dependency JavaScript module and jQuery plugin which returns the most visible element from a given set.\n\n## Installation\n\n#### Download\n* [most-visible.min.js](https://unpkg.com/most-visible@2.0.0/dist/most-visible.min.js)\n* [most-visible.js](https://unpkg.com/most-visible@2.0.0/dist/most-visible.js)\n\n#### CDN\n```html\n\u003cscript src=\"https://unpkg.com/most-visible@2.0.0/dist/most-visible.min.js\"\u003e\u003c/script\u003e\n\u003c!-- OR --\u003e\n\u003cscript src=\"https://unpkg.com/most-visible@2.0.0/dist/most-visible.js\"\u003e\u003c/script\u003e\n```\n\n#### Package Managers\n\nInstall via [Bun](https://bun.sh/):\n```sh\n$ bun add most-visible\n```\n\nInstall via yarn:\n```sh\n$ yarn add most-visible\n```\n\nInstall via NPM:\n```sh\n$ npm install most-visible --save\n```\n\n## Usage\n\n### Browser\n\n#### jQuery\n\nThe plugin will automatically be added to any global (window) version of jQuery:\n\n```js\n$('.my-elements').mostVisible().addClass('most-visible');\n\n// with options\n$('.my-elements').mostVisible({percentage: true, offset: 160}).addClass('most-visible');\n```\n\n#### Vanilla JavaScript\n\nYou can pass in either a selector string:\n```js\nconst element = mostVisible('.my-elements');\n```\n\nOr a NodeList:\n```js\nconst element = mostVisible(document.querySelectorAll('.my-elements'));\n```\n\n### Webpack etc.\n\n```js\nimport mostVisible from 'most-visible';\n\nconst element = mostVisible('.my-elements');\n```\n\nTo attach the jQuery plugin to a non-global version of jQuery you must call `.makejQueryPlugin`:\n\n```js\nimport $ from 'jquery';\nimport {mostVisible, makejQueryPlugin} from 'most-visible';\n\nmakejQueryPlugin($, mostVisible);\n\n$('.my-elements').removeClass('active').mostVisible().addClass('active');\n```\n\n## Options\n| Option         | Type               | Description                                                                                  | Default           |\n|----------------|--------------------|----------------------------------------------------------------------------------------------|-------------------|\n| percentage     | `boolean`          | Whether to calculate the visibility of an element as a percentage of its height              | `false`           |                                                                     | `''`              |\n| offset         | `number`           | A pixel offset to use when calculating visibility. Useful for e.g fixed headers.             | `0`               |\n\nModify the `mostVisible.defaults` object to change default option values:\n\n```js\nmostVisible.defaults.percentage = true;\nmostVisible.defaults.offset = 160;\n```\n\n## License\n\nReleased under the [MIT license](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyexeter%2Fmost-visible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandyexeter%2Fmost-visible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyexeter%2Fmost-visible/lists"}