{"id":21810676,"url":"https://github.com/samdark/the-modal","last_synced_at":"2025-04-05T17:09:15.650Z","repository":{"id":3856960,"uuid":"4941819","full_name":"samdark/the-modal","owner":"samdark","description":"Proper modal boxes","archived":false,"fork":false,"pushed_at":"2019-05-23T15:42:44.000Z","size":87,"stargazers_count":306,"open_issues_count":12,"forks_count":65,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-03-29T16:05:23.659Z","etag":null,"topics":["modal","modal-box","ui"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samdark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"samdark","patreon":"samdark"}},"created_at":"2012-07-07T22:20:53.000Z","updated_at":"2025-03-26T21:18:24.000Z","dependencies_parsed_at":"2022-07-07T16:51:37.547Z","dependency_job_id":null,"html_url":"https://github.com/samdark/the-modal","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samdark%2Fthe-modal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samdark%2Fthe-modal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samdark%2Fthe-modal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samdark%2Fthe-modal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samdark","download_url":"https://codeload.github.com/samdark/the-modal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369953,"owners_count":20927928,"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":["modal","modal-box","ui"],"created_at":"2024-11-27T13:37:06.847Z","updated_at":"2025-04-05T17:09:15.634Z","avatar_url":"https://github.com/samdark.png","language":"JavaScript","funding_links":["https://github.com/sponsors/samdark","https://patreon.com/samdark"],"categories":["Stale"],"sub_categories":["General Frontend"],"readme":"The Modal\n=========\n\nThe goal of this jQuery plugin is to implement modal boxes.\n\nIf the box is modal then:\n\n- Page itself should not be scrollable.\n- Modal box content should be scrollable independent of the page.\n\nFacebook and vk.com photo modals are working like that and I think\nit's the right way to go.\n\nBefore describing features and API here's [the demo](http://rmcreative.ru/playground/modals_plugin/demo.html).\n\nFeatures\n--------\n\n- No extra markup required.\n- You can use it w/o markup at all by opening empty modal and filling it with\n  custom data the way you want (see below).\n- Optional close on ESC (enabled by default).\n\nMore to come.\n\nUsage\n-----\n\nIn order to use this plugin you need the following in the `head` section of your HTML:\n\n```html\n\u003cscript type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"jquery.the-modal.js\"\u003e\u003c/script\u003e\n\u003clink rel=\"stylesheet\" type=\"text/css\" href=\"the-modal.css\" media=\"all\" /\u003e\n```\n\n### HTML-markup as modal content\n\nHTML:\n\n```html\n\u003cdiv class=\"modal\" id=\"terms-of-service\" style=\"display: none\"\u003e\n\t\t\u003ca href=\"#\" class=\"close\"\u003e×\u003c/a\u003e\n\n\t\tTerms of service here\n\u003c/div\u003e\n```\n\nJavaScript:\n\n```javascript\n// attach close button handler\n$('.modal .close').on('click', function(e){\n\te.preventDefault();\n\t$.modal().close();\n});\n\n// open modal with default options or options set with init\n// content will be taken from #login\n$('#terms-of-service').modal().open();\n\n// also we can open modal overriding some default options\n$('#terms-of-service').modal().open({\n\tcloseOnESC: false\n});\n\n// Close modal. There's no need to choose which one since only one can be opened\n$.modal().close();\n```\n\n### Custom content\n\n```javascript\n$.modal().open({\n\tonOpen: function(el, options){\n\t\tel.html('Hello!');\n\t}\n});\n```\n\n### AJAX-content\n\n```javascript\n$.modal().open({\n\tonOpen: function(el, options){\n\t\t$.get('http://example.com/', function(data){\n\t\t\tel.html(data);\n\t\t});\n\t}\n});\n```\n\n### Available options (default values)\n\n```javascript\n$.modal({\n\t/* css class of locked container(body) */\n\tlockClass: 'themodal-lock',\n\n\t/* css class of overlay */\n\toverlayClass: 'themodal-overlay',\n\n\t/* close modal on press ESC */\n\tcloseOnEsc: true,\n\n\t/* close overlay when clicked on it */\n\tcloseOnOverlayClick: true,\n\n\t/* callback function(overlay, localOptions){}, called before modal close,\n\tmust be return bool(if true - close, if false - prevent closing) */\n\tonBeforeClose: null,\n\n\t/* callback function(overlay, localOptions){}, called after modal close */\n\tonClose: null,\n\n\t/* callback function(overlay, localOptions){}, called after modal open */\n\tonOpen: null,\n\n\t/* clone modal dom element on open or toggle it's visibility */\n\tcloning: true\n});\n```\n\n### Overriding options\n\n```javascript\n// set option as default for all modals opened\n$.modal({\n\tcloseOnESC: true\n});\n\n// set some default options for specific dom element\n$('#login').modal({\n\tcloseOnESC: true,\n\tonClose: function(el, options) {\n\t\talert('Closed!');\n\t}\n});\n```\n\nKnown issues to be fixed\n------------------------\n\n- FF scrolls page instead of modal content when pressing cursor keys and PGUP,\n  PGDWN. If content of the modal is clicked once, it works fine.\n- After scrolling down all modal content iOS Safari is starting scrolling page content.\n\nLicense\n-------\n\nThe Modal is a free software. It is released under the terms of the following BSD License.\n\nCopyright © 2013 by Alexander Makarov\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\nRedistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\nNeither the name of Alexander Makarov nor the names of project contributors may be used to endorse or promote products derived from this software without specific prior written permission.\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamdark%2Fthe-modal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamdark%2Fthe-modal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamdark%2Fthe-modal/lists"}