Browse Source

Prevent default link action when showing modals

Clicking a link that displays a modal will cause the page
to scroll to the bottom of the content if the content is longer
than the height of the viewport. This change prevents that from
happening.
pull/192/head
Jonathan Clem 12 years ago
parent
commit
61c60b36c7
  1. 14
      dist/ratchet.js
  2. 7
      lib/js/modals.js

14
dist/ratchet.js vendored

@ -28,9 +28,13 @@
window.addEventListener('touchend', function (event) { window.addEventListener('touchend', function (event) {
var modal = getModal(event); var modal = getModal(event);
if (modal) modal.classList.toggle('active'); if (modal) {
event.preventDefault();
modal.classList.toggle('active');
}
}); });
}();/* ---------------------------------- }();
/* ----------------------------------
* POPOVER v1.0.0 * POPOVER v1.0.0
* Licensed under The MIT License * Licensed under The MIT License
* http://opensource.org/licenses/MIT * http://opensource.org/licenses/MIT
@ -117,12 +121,13 @@
'slide-out' : 'slide-in', 'slide-out' : 'slide-in',
'fade' : 'fade' 'fade' : 'fade'
}; };
var bars = { var bars = {
bartab : '.bar-tab', bartab : '.bar-tab',
bartitle : '.bar-title', bartitle : '.bar-title',
barfooter : '.bar-footer', barfooter : '.bar-footer',
barheadersecondary : '.bar-header-secondary' barheadersecondary : '.bar-header-secondary'
} };
var cacheReplace = function (data, updates) { var cacheReplace = function (data, updates) {
PUSH.id = data.id; PUSH.id = data.id;
@ -509,7 +514,8 @@
window.addEventListener('click', function (e) { if (getTarget(e)) e.preventDefault(); }); window.addEventListener('click', function (e) { if (getTarget(e)) e.preventDefault(); });
window.addEventListener('popstate', popstate); window.addEventListener('popstate', popstate);
}();/* ---------------------------------- }();
/* ----------------------------------
* TABS v1.0.0 * TABS v1.0.0
* Licensed under The MIT License * Licensed under The MIT License
* http://opensource.org/licenses/MIT * http://opensource.org/licenses/MIT

7
lib/js/modals.js

@ -20,6 +20,9 @@
window.addEventListener('touchend', function (event) { window.addEventListener('touchend', function (event) {
var modal = getModal(event); var modal = getModal(event);
if (modal) modal.classList.toggle('active'); if (modal) {
event.preventDefault();
modal.classList.toggle('active');
}
}); });
}(); }();

Loading…
Cancel
Save