All Projects → samdark → The Modal

samdark / The Modal

Licence: other
Proper modal boxes

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to The Modal

nglp-angular-material-landing-page
NGLP is an Angular Material Landing Page.
Stars: ✭ 32 (-89.71%)
Mutual labels:  modal
next-use-contextual-routing
Generate contextual routing / modal routes paths for Next.js
Stars: ✭ 76 (-75.56%)
Mutual labels:  modal
Ng2 Bs3 Modal
Angular Bootstrap 3 Modal Component
Stars: ✭ 273 (-12.22%)
Mutual labels:  modal
ng-sq-ui
Flexible and easily customizable UI-kit for Angular 11+
Stars: ✭ 99 (-68.17%)
Mutual labels:  modal
bootstrap-modal-wrapper
Bootstrap modal factory that supports dynamic modal creations and nested stacked modal features.
Stars: ✭ 18 (-94.21%)
Mutual labels:  modal
Ngx Smart Modal
Modal/Dialog component crafted for Angular
Stars: ✭ 256 (-17.68%)
Mutual labels:  modal
dxkSynthDefs
some synth defs for SuperCollider
Stars: ✭ 21 (-93.25%)
Mutual labels:  modal
Tltransitions
快速实现控制器的转场和View的快速popover显示,并支持自定义动画、手势退场
Stars: ✭ 296 (-4.82%)
Mutual labels:  modal
react-micro-modal
Accessible, lightweight and configurable modal component with a11y-enabled.
Stars: ✭ 36 (-88.42%)
Mutual labels:  modal
React Native Image View
Modal component to view images with zoom
Stars: ✭ 273 (-12.22%)
Mutual labels:  modal
react-native-awesome-alert
🔔 Customizable modal components with ✔️check options in React Native
Stars: ✭ 50 (-83.92%)
Mutual labels:  modal
D2PCurvedModal
An elegant and curved modal View for iOS (Swift)
Stars: ✭ 59 (-81.03%)
Mutual labels:  modal
Vue Modal Dialogs
Promisify dialogs in Vue!
Stars: ✭ 259 (-16.72%)
Mutual labels:  modal
angular-super-gallery
AngularJS super image gallery
Stars: ✭ 46 (-85.21%)
Mutual labels:  modal
Body Scroll Lock
Body scroll locking that just works with everything 😏
Stars: ✭ 3,357 (+979.42%)
Mutual labels:  modal
react-gallery-carousel
Mobile-friendly gallery carousel 🎠 with server side rendering, lazy loading, fullscreen, thumbnails, touch, mouse emulation, RTL, keyboard navigation and customisations.
Stars: ✭ 178 (-42.77%)
Mutual labels:  modal
jsPanel3
A jQuery Plugin to create highly configurable floating panels, modals, tooltips, hints/notifiers or contextmenus for use in a backend solution and other web applications.
Stars: ✭ 89 (-71.38%)
Mutual labels:  modal
Basiclightbox
The lightest lightbox ever made.
Stars: ✭ 299 (-3.86%)
Mutual labels:  modal
Popbox.js
A tiny and simple stackable modal plugin for web apps
Stars: ✭ 295 (-5.14%)
Mutual labels:  modal
Cupertino Pane
🎉📱Multi-functional panes and boards for next generation progressive applications
Stars: ✭ 267 (-14.15%)
Mutual labels:  modal

The Modal

The goal of this jQuery plugin is to implement modal boxes.

If the box is modal then:

  • Page itself should not be scrollable.
  • Modal box content should be scrollable independent of the page.

Facebook and vk.com photo modals are working like that and I think it's the right way to go.

Before describing features and API here's the demo.

Features

  • No extra markup required.
  • You can use it w/o markup at all by opening empty modal and filling it with custom data the way you want (see below).
  • Optional close on ESC (enabled by default).

More to come.

Usage

In order to use this plugin you need the following in the head section of your HTML:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src="jquery.the-modal.js"></script>
<link rel="stylesheet" type="text/css" href="the-modal.css" media="all" />

HTML-markup as modal content

HTML:

<div class="modal" id="terms-of-service" style="display: none">
		<a href="#" class="close">×</a>

		Terms of service here
</div>

JavaScript:

// attach close button handler
$('.modal .close').on('click', function(e){
	e.preventDefault();
	$.modal().close();
});

// open modal with default options or options set with init
// content will be taken from #login
$('#terms-of-service').modal().open();

// also we can open modal overriding some default options
$('#terms-of-service').modal().open({
	closeOnESC: false
});

// Close modal. There's no need to choose which one since only one can be opened
$.modal().close();

Custom content

$.modal().open({
	onOpen: function(el, options){
		el.html('Hello!');
	}
});

AJAX-content

$.modal().open({
	onOpen: function(el, options){
		$.get('http://example.com/', function(data){
			el.html(data);
		});
	}
});

Available options (default values)

$.modal({
	/* css class of locked container(body) */
	lockClass: 'themodal-lock',

	/* css class of overlay */
	overlayClass: 'themodal-overlay',

	/* close modal on press ESC */
	closeOnEsc: true,

	/* close overlay when clicked on it */
	closeOnOverlayClick: true,

	/* callback function(overlay, localOptions){}, called before modal close,
	must be return bool(if true - close, if false - prevent closing) */
	onBeforeClose: null,

	/* callback function(overlay, localOptions){}, called after modal close */
	onClose: null,

	/* callback function(overlay, localOptions){}, called after modal open */
	onOpen: null,

	/* clone modal dom element on open or toggle it's visibility */
	cloning: true
});

Overriding options

// set option as default for all modals opened
$.modal({
	closeOnESC: true
});

// set some default options for specific dom element
$('#login').modal({
	closeOnESC: true,
	onClose: function(el, options) {
		alert('Closed!');
	}
});

Known issues to be fixed

  • FF scrolls page instead of modal content when pressing cursor keys and PGUP, PGDWN. If content of the modal is clicked once, it works fine.
  • After scrolling down all modal content iOS Safari is starting scrolling page content.

License

The Modal is a free software. It is released under the terms of the following BSD License.

Copyright © 2013 by Alexander Makarov All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions 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. Neither 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. THIS 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].