Sha256: bb5704f50ad1010dc7be5e9135242b42a534584cb4e2fa71c38b02767436bc12

Contents?: true

Size: 1.33 KB

Versions: 39

Compression:

Stored size: 1.33 KB

Contents

/**
 * modalEffects.js v1.0.0
 * http://www.codrops.com
 *
 * Licensed under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * Copyright 2013, Codrops
 * http://www.codrops.com
 */
var ModalEffects = (function() {

	function init() {

		var overlay = document.querySelector( '.md-overlay' );

		[].slice.call( document.querySelectorAll( '.md-trigger' ) ).forEach( function( el, i ) {

			var modal = document.querySelector( '#' + el.getAttribute( 'data-modal' ) ),
				close = modal.querySelector( '.md-close' );

			function removeModal( hasPerspective ) {
				classie.remove( modal, 'md-show' );

				if( hasPerspective ) {
					classie.remove( document.documentElement, 'md-perspective' );
				}
			}

			function removeModalHandler() {
				removeModal( classie.has( el, 'md-setperspective' ) ); 
			}

			el.addEventListener( 'click', function( ev ) {
				classie.add( modal, 'md-show' );
				overlay.removeEventListener( 'click', removeModalHandler );
				overlay.addEventListener( 'click', removeModalHandler );

				if( classie.has( el, 'md-setperspective' ) ) {
					setTimeout( function() {
						classie.add( document.documentElement, 'md-perspective' );
					}, 25 );
				}
			});

			close.addEventListener( 'click', function( ev ) {
				ev.stopPropagation();
				removeModalHandler();
			});

		} );

	}

	init();

})();

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
wbase-0.3.20 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.19 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.18 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.17 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.16 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.15 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.14 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.13 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.12 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.11 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.10 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.9 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.8 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.7 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.6 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.5 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.4 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.3 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.2 lib/vendor/admin/modal-effect/js/modalEffects.js
wbase-0.3.1 lib/vendor/admin/modal-effect/js/modalEffects.js