Révision e4c061ad
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/ctools/js/modal.js | ||
---|---|---|
379 | 379 |
css.filter = 'alpha(opacity=' + (100 * css.opacity) + ')'; |
380 | 380 |
content.hide(); |
381 | 381 |
|
382 |
// if we already ahve a modalContent, remove it
|
|
383 |
if ( $('#modalBackdrop')) $('#modalBackdrop').remove();
|
|
384 |
if ( $('#modalContent')) $('#modalContent').remove();
|
|
382 |
// If we already have modalContent, remove it.
|
|
383 |
if ($('#modalBackdrop').length) $('#modalBackdrop').remove();
|
|
384 |
if ($('#modalContent').length) $('#modalContent').remove();
|
|
385 | 385 |
|
386 | 386 |
// position code lifted from http://www.quirksmode.org/viewport/compatibility.html |
387 | 387 |
if (self.pageYOffset) { // all except Explorer |
... | ... | |
421 | 421 |
return true; |
422 | 422 |
} |
423 | 423 |
} |
424 |
if( $(target).filter('*:visible').parents('#modalContent').size()) { |
|
425 |
// allow the event only if target is a visible child node of #modalContent |
|
424 |
|
|
425 |
if ($(target).is('#modalContent, body') || $(target).filter('*:visible').parents('#modalContent').length) { |
|
426 |
// Allow the event only if target is a visible child node |
|
427 |
// of #modalContent. |
|
426 | 428 |
return true; |
427 | 429 |
} |
428 |
if ( $('#modalContent')) $('#modalContent').get(0).focus(); |
|
429 |
return false; |
|
430 |
else { |
|
431 |
$('#modalContent').focus(); |
|
432 |
} |
|
433 |
|
|
434 |
event.preventDefault(); |
|
430 | 435 |
}; |
431 | 436 |
$('body').bind( 'focus', modalEventHandler ); |
432 | 437 |
$('body').bind( 'keypress', modalEventHandler ); |
... | ... | |
477 | 482 |
|
478 | 483 |
// Move and resize the modalBackdrop and modalContent on resize of the window |
479 | 484 |
modalContentResize = function(){ |
485 |
|
|
486 |
// position code lifted from http://www.quirksmode.org/viewport/compatibility.html |
|
487 |
if (self.pageYOffset) { // all except Explorer |
|
488 |
var wt = self.pageYOffset; |
|
489 |
} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict |
|
490 |
var wt = document.documentElement.scrollTop; |
|
491 |
} else if (document.body) { // all other Explorers |
|
492 |
var wt = document.body.scrollTop; |
|
493 |
} |
|
494 |
|
|
480 | 495 |
// Get our heights |
481 | 496 |
var docHeight = $(document).height(); |
482 | 497 |
var docWidth = $(document).width(); |
... | ... | |
486 | 501 |
|
487 | 502 |
// Get where we should move content to |
488 | 503 |
var modalContent = $('#modalContent'); |
489 |
var mdcTop = ( winHeight / 2 ) - ( modalContent.outerHeight() / 2);
|
|
504 |
var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2);
|
|
490 | 505 |
var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); |
491 | 506 |
|
492 | 507 |
// Apply the changes |
Formats disponibles : Unified diff
Weekly update of contrib modules