mirror of https://github.com/twbs/ratchet.git
Build mobile apps with simple HTML, CSS, and JS components.
http://goratchet.com/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
776 B
25 lines
776 B
12 years ago
|
/* ----------------------------------
|
||
11 years ago
|
* MODAL v1.0.0
|
||
12 years ago
|
* Licensed under The MIT License
|
||
|
* http://opensource.org/licenses/MIT
|
||
|
* ---------------------------------- */
|
||
|
|
||
|
!function () {
|
||
12 years ago
|
var findModals = function (target) {
|
||
11 years ago
|
var i;
|
||
|
var modals = document.querySelectorAll('a');
|
||
12 years ago
|
for (; target && target !== document; target = target.parentNode) {
|
||
|
for (i = modals.length; i--;) { if (modals[i] === target) return target; }
|
||
12 years ago
|
}
|
||
|
};
|
||
|
|
||
12 years ago
|
var getModal = function (event) {
|
||
|
var modalToggle = findModals(event.target);
|
||
12 years ago
|
if (modalToggle && modalToggle.hash) return document.querySelector(modalToggle.hash);
|
||
12 years ago
|
};
|
||
|
|
||
12 years ago
|
window.addEventListener('touchend', function (event) {
|
||
|
var modal = getModal(event);
|
||
11 years ago
|
if (modal) modal.classList.toggle('active');
|
||
12 years ago
|
});
|
||
11 years ago
|
}();
|