{"id":16641836,"url":"https://github.com/samthor/mobile-first","last_synced_at":"2025-10-30T11:31:19.700Z","repository":{"id":24453917,"uuid":"27856637","full_name":"samthor/mobile-first","owner":"samthor","description":"Custom element to contain content within mock device 📱","archived":false,"fork":false,"pushed_at":"2021-10-19T04:28:45.000Z","size":366,"stargazers_count":19,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-26T00:42:39.587Z","etag":null,"topics":["custom-elements","gesture","mobile","phone"],"latest_commit_sha":null,"homepage":"https://samthor.github.io/mobile-first","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samthor.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}},"created_at":"2014-12-11T06:02:21.000Z","updated_at":"2023-02-24T15:08:20.000Z","dependencies_parsed_at":"2022-08-26T18:21:56.342Z","dependency_job_id":null,"html_url":"https://github.com/samthor/mobile-first","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fmobile-first","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fmobile-first/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fmobile-first/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samthor%2Fmobile-first/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samthor","download_url":"https://codeload.github.com/samthor/mobile-first/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238960275,"owners_count":19559233,"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":["custom-elements","gesture","mobile","phone"],"created_at":"2024-10-12T07:48:02.567Z","updated_at":"2025-10-30T11:31:14.377Z","avatar_url":"https://github.com/samthor.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"The `mobile-first` custom element takes \"Mobile First\" to a whole new level.\nIf viewed on a desktop or tablet, it will embed its content within a mock image of a mobile device.\nThis will allow your users to experience your site as you originally intended.\n[Play with the demo!](https://samthor.github.io/mobile-first/)\n\nThe device can be rotated through mouse gestures, to view your site in landscape on the contained mock device.\n\n## Why?\n\nWhy not?\n\nMaybe you can use this for mobile demos.\n\n## Usage\n\nInstall via `mobile-first-element` and include the element:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import './node-modules/mobile-first-element/mobile-first.js';\n  // or possibly...\n  import 'mobile-first-element';\n\u003c/script\u003e\n\u003cmobile-first\u003e\n  \u003ch5\u003eYour Page!\u003c/h5\u003e\n\u003c/mobile-first\u003e\n```\n\nAlternatively, include an `\u003ciframe\u003e` to another site:\n\n```html\n\u003cstyle type=\"text/css\"\u003e\n  /** Include this CSS for iframes so they fit the mock device. */\n  mobile-first \u003e iframe {\n    display: block;\n    width: 100%;\n    height: 100%;\n    border: 0;\n  }\n\u003c/style\u003e\n\u003cmobile-first\u003e\n  \u003ciframe src=\"mobile-site.html\"\u003e\u003c/iframe\u003e\n\u003c/mobile-first\u003e\n```\n\n(A lot of major site use [`X-Frame-Options`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options) to prevent this, though—maybe just contain your own content.)\n\n### Configuration\n\nThere are a few attributes that can be modified.\n\n* `device` controls the mock device used: currently, this supports \"nexus5\" and \"iphone5\". By default, `mobile-first` chooses a random device from its available devices.\n\n* `width` may be set to explicitly control the width at which the `mobile-first` element shows a mock device.\n  Below this width, this element will act as a boring `div` that just contains its content—ideal for your users who are _already_ on a mobile device!\n\n## Support\n\nTested on Chrome 58+ and Safari 10.1 (without animations), may work on other browsers that support Custom Elements and Shadow DOM.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamthor%2Fmobile-first","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamthor%2Fmobile-first","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamthor%2Fmobile-first/lists"}