{"id":19142390,"url":"https://github.com/eldoy/modalis","last_synced_at":"2026-06-24T00:31:21.863Z","repository":{"id":139868558,"uuid":"474464235","full_name":"eldoy/modalis","owner":"eldoy","description":"Modal dialog","archived":false,"fork":false,"pushed_at":"2023-10-08T12:32:35.000Z","size":397,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T19:24:31.717Z","etag":null,"topics":[],"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/eldoy.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":"2022-03-26T20:54:53.000Z","updated_at":"2023-02-24T19:49:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"a6436b6d-20bc-4081-8ed0-28afcf58b422","html_url":"https://github.com/eldoy/modalis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eldoy/modalis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fmodalis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fmodalis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fmodalis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fmodalis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eldoy","download_url":"https://codeload.github.com/eldoy/modalis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fmodalis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34712578,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"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":[],"created_at":"2024-11-09T07:27:04.060Z","updated_at":"2026-06-24T00:31:21.843Z","avatar_url":"https://github.com/eldoy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Modalis\n\nModal dialog with built in loading of HTML.\n\n### Usage\n\nFirst copy `dist/assets/css/modal.css` and `dist/assets/js/modal.js` to your app assets. Use `dist/layouts/modal.js` for some working HTML you can use for your modal layout.\n\nIncluded is also an example of a \"prompt\", for use with a modal inside the modal.\n\nAdd an empty div tag with the class name `modal` in your main app layout, before the end `\u003c/body\u003e` tag:\n```html\n\u003cdiv class=\"modal\"\u003e\u003c/div\u003e\n```\n\nTo open the modal add an element like this:\n```html\n\u003cbutton\n  onclick=\"openModal(this)\"\n  data-modal=\".modal\"\n  data-href=\"/modal\"\n\u003e\n  Open modal\n\u003c/button\u003e\n```\nThe `data-modal` is the selector of your modal.\n\n### Load modal content from server\n\nIf you want to load HTML into the modal, use `data-href` and add the path there.\n\nUsing a link the modal modal will be filled with the contents of the `href` attribute:\n```html\n\u003ca\n  onclick=\"openModal(this);return false\"\n  data-modal=\".modal\"\n  href=\"/modal\"\n\u003e\n  Open modal\n\u003c/a\u003e\n```\n\n### Insert modal content from DOM\n\nTo load insert content from the DOM, use `data-source`:\n\n```html\n\u003cbutton\n  onclick=\"openModal(this)\"\n  data-modal=\".modal\"\n  data-source=\".content\"\n\u003e\n  Open modal\n\u003c/button\u003e\n```\n\nThis technique requires a modal layout to be included in the DOM:\n```html\n\u003cbody\u003e\n  ...\n  \u003cdiv class=\"modal-layout\"\u003e\n    \u003cdiv class=\"modal-frame\"\u003e\n      \u003cdiv class=\"modal-border\"\u003e\n        \u003cdiv class=\"modal-header\"\u003e\n          \u003cbutton onclick=\"closeModal(this)\" data-modal=\".modal\"\u003eClose\u003c/button\u003e\n        \u003c/div\u003e\n        \u003cdiv class=\"modal-content\"\u003e\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n  \u003c/div\u003e\n\u003c/body\u003e\n```\n\nThe default selector for the modal layout is `.modal-layout`, but you can specify it like this:\n\n```html\n\u003cbutton\n  onclick=\"openModal(this)\"\n  data-modal=\".modal\"\n  data-source=\".content\"\n  data-layout=\".my-layout\"\n\u003e\n  Open modal\n\u003c/button\u003e\n```\n\nThe source of the modal content should only have 1 root element:\n\n```html\n\u003cdiv id=\"content\" style=\"display:none\"\u003e\n  \u003cdiv id=\"root\"\u003e\n    The content to be inserted goes here.\n  \u003c/div\u003e\n\u003c/div\u003e\n```\n\n### Set modal title\n\nTo set or override the modal title, use the `data-title` attribute on your toggler:\n\n```html\n\u003cbutton\n  onclick=\"openModal(this)\"\n  data-title=\"Modal title\"\n  data-modal=\".modal\"\n  data-source=\".content\"\n  data-layout=\".my-layout\"\n\u003e\n  Open modal\n\u003c/button\u003e\n```\n\nThis is dependent on an element with a `modal-title` class in your modal layout.\n\n\n### Close the modal\n\nTo close the modal use `closeModal`:\n```html\n\u003cbutton\n  onclick=\"closeModal(this)\"\n  data-modal=\".modal\"\n\u003e\n  Close\n\u003c/button\u003e\n```\n\nor you can close it programmatically like this:\n```js\n// Pass selector of modal element\ncloseModal('.modal')\n```\n\nMIT Licensed. Enjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Fmodalis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldoy%2Fmodalis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Fmodalis/lists"}