12345678910111213141516171819202122232425262728293031323334353637 |
- /**
- * Modals
- * @param {type} $
- * @param {type} window
- * @param {type} document
- * @param {type} name
- * @returns {undefined}
- */
- (function($, window, document, name) {
- var CLASS_MODAL = $.className('modal');
- var handle = function(event, target) {
- if (target.tagName === 'A' && target.hash) {
- var modal = document.getElementById(target.hash.replace('#', ''));
- if (modal && modal.classList.contains(CLASS_MODAL)) {
- return modal;
- }
- }
- return false;
- };
- $.registerTarget({
- name: name,
- index: 50,
- handle: handle,
- target: false,
- isReset: false,
- isContinue: true
- });
- window.addEventListener('tap', function(event) {
- if ($.targets.modal) {
- event.detail.gesture.preventDefault(); //fixed hashchange
- $.targets.modal.classList.toggle($.className('active'));
- }
- });
- })(mui, window, document, 'modal');
|