From: Ben Schwarz Date: Mon, 24 Dec 2012 01:39:59 +0000 (+1100) Subject: Remove spaces around arguments X-Git-Url: http://git.roojs.org/?p=ratchet;a=commitdiff_plain;h=086e1f7e43f1f4ca4ab802acce6ad51266ac3a44 Remove spaces around arguments --- diff --git a/docs/modal-demo.html b/docs/modal-demo.html new file mode 100644 index 0000000..bdaca17 --- /dev/null +++ b/docs/modal-demo.html @@ -0,0 +1,32 @@ + + + + + Modal slideup + + + + + + + + + +
+ Open modal +
+ + + + \ No newline at end of file diff --git a/lib/js/modals.js b/lib/js/modals.js index d938c53..1939493 100644 --- a/lib/js/modals.js +++ b/lib/js/modals.js @@ -5,36 +5,36 @@ * ---------------------------------- */ !function () { - findModals = function ( target ) { - var i, - modals = document.querySelectorAll( 'a' ); + var findModals = function (target) { + var i; + var modals = document.querySelectorAll('a'); - for ( ; target && target !== document; target = target.parentNode ) { - for ( i = modals.length; i--; ) { if ( modals[i] === target ) return target; } + for (; target && target !== document; target = target.parentNode) { + for (i = modals.length; i--;) { if (modals[i] === target) return target; } } }; - getModal = function ( event ) { - var modal, - modalToggle = findModals( event.target ); + var getModal = function (event) { + var modal; + var modalToggle = findModals(event.target); - if ( !modalToggle || !modalToggle.hash ) return; + if (!modalToggle || !modalToggle.hash) return; - modal = document.querySelector( modalToggle.hash ) + modal = document.querySelector(modalToggle.hash); - if ( !modal ) return; + if (!modal) return; return modal; }; - window.addEventListener( 'touchend', function ( event ) { - var modal = getModal( event ); + window.addEventListener('touchend', function (event) { + var modal = getModal(event); - if ( !modal ) return; + if (!modal) return; modal.offsetHeight; - modal.classList.toggle( 'active' ); - } ); + modal.classList.toggle('active'); + }); - window.addEventListener( 'click', function ( event ) { - if ( getModal( event ) ) event.preventDefault(); - } ); + window.addEventListener('click', function (event) { + if (getModal(event)) event.preventDefault(); + }); }(); \ No newline at end of file