ajax-register.js 875 B

1234567891011121314151617181920212223242526
  1. (function ($) {
  2. Drupal.behaviors.ajaxRegister = {
  3. attach: function (context){
  4. // Make modal window height scaled automatically.
  5. $('.ctools-modal-content, #modal-content', context).height('auto');
  6. // Position code lifted from http://www.quirksmode.org/viewport/compatibility.html
  7. if (self.pageYOffset) { // all except Explorer
  8. var wt = self.pageYOffset;
  9. }
  10. else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
  11. var wt = document.documentElement.scrollTop;
  12. }
  13. else if (document.body) { // all other Explorers
  14. var wt = document.body.scrollTop;
  15. }
  16. // Fix CTools bug: calculate correct 'top' value.
  17. var mdcTop = wt + ( $(window).height() / 2 ) - ($('#modalContent', context).outerHeight() / 2);
  18. $('#modalContent', context).css({top: mdcTop + 'px'});
  19. }
  20. }
  21. })(jQuery);