{"id":16760522,"url":"https://github.com/ryanve/dime","last_synced_at":"2025-08-08T01:04:00.614Z","repository":{"id":2630294,"uuid":"3617445","full_name":"ryanve/dime","owner":"ryanve","description":"Cross-browser JavaScript dimensions module","archived":false,"fork":false,"pushed_at":"2013-11-18T21:34:24.000Z","size":144,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-21T23:55:14.940Z","etag":null,"topics":["dimension","dimensions","dom"],"latest_commit_sha":null,"homepage":"https:/npm.im/dime","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/ryanve.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":"2012-03-04T10:38:22.000Z","updated_at":"2024-02-04T19:39:28.000Z","dependencies_parsed_at":"2022-07-10T16:17:20.923Z","dependency_job_id":null,"html_url":"https://github.com/ryanve/dime","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/ryanve/dime","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fdime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fdime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fdime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fdime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanve","download_url":"https://codeload.github.com/ryanve/dime/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fdime/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269348099,"owners_count":24401885,"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","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["dimension","dimensions","dom"],"created_at":"2024-10-13T04:23:46.253Z","updated_at":"2025-08-08T01:04:00.566Z","avatar_url":"https://github.com/ryanve.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [dime](../../)\n#### cross-browser JavaScript [module](https://npmjs.org/package/dime) to measure dimensions\n\n```bash\n$ npm install dime\n```\n\n## API ([3.0](../../releases))\n\n### Static methods\n#### Fast simple top-level methods\n\n```js\ndime.width(object) // get width\ndime.height(object) // get height\ndime.width(element, px) // set width\ndime.height(element, px) // set height\n```\n\n#### Measurable objects\n\n- `window`\n- DOM node: `document` or element\n- object with `.width`/`.height` properties or methods\n\n```js\ndime.width(screen) // =\u003e screen.width\ndime.width({width:10, height:10}) // =\u003e 10\n```\n\n### Chain methods\n#### jQueryish methods for compatible libs (such as [ender](https://github.com/ender-js))\n\n```js\n.width() // get the width of the 1st elem in the set\n.width(value) // set the width of all elems in the set\n.height() // get the width of the 1st elem in the set\n.height(value) // set the width of all elems in the set\n```\n\n### Integrated usage\n\n```js\n$(window).width()\n$(document).width()\n$(element).width()\n$(element).width(100)\n```\n\n### Standalone usage\n\n```js\ndime.fn.width.call(stack)\ndime.fn.width.call(stack, px)\n```\n\n#### Standalone examples\n\nIt is only sensible to use these for *setting* dimensions\u0026mdash;the [statics](#static-methods) are faster for gets.\n\n```js\ndime.fn.width.call([document]) // same as dime.width(document)\ndime.fn.width.call(document.querySelectorAll('.example'), 100)\n```\n\n## [Version](../../releases) notes\n\n#### 3.x is leaner than previous releases\n- 2.x device methods were removed because the native [`screen`](http://ryanve.com/lab/dimensions/#device) provides these.\n- 2.x viewport methods were removed in favor of `dime.width(window)` although those methods \nare available in [verge](#related-modules).\n- In 3.x `dime` is a plain object\u0026mdash;not a wrapper function.\n\n## Related modules\n\n- [verge](https://github.com/ryanve/verge): viewport utilities\n\n## Resources\n\n- [Lab: dimensions](http://ryanve.com/lab/dimensions/)\n\n## License: [MIT](http://en.wikipedia.org/wiki/MIT_License)\n\nCopyright (C) 2012 by [Ryan Van Etten](https://github.com/ryanve)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Fdime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanve%2Fdime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Fdime/lists"}