Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Popup: Pass placement through "popupbeforeposition" to allow handlers…

… to modify the popup positioning
  • Loading branch information...
commit 99efbff4eaf4a4d32ce8b1e0223cc47a08334c2f 1 parent 68f245d
@gabrielschulhof gabrielschulhof authored
Showing with 12 additions and 12 deletions.
  1. +12 −12 js/widgets/popup.js
View
24 js/widgets/popup.js
@@ -536,10 +536,16 @@ define( [
return { x: x, y: y };
},
+ _reposition: function( o ) {
+ // We only care about position-related parameters for repositioning
+ o = { x: o.x, y: o.y, positionTo: o.positionTo };
+ this._trigger( "beforeposition", o );
+ this._ui.container.offset( this._placementCoords( this._desiredCoords( o ) ) );
+ },
+
reposition: function( o ) {
if ( this._isOpen ) {
- this._trigger( "beforeposition" );
- this._ui.container.offset( this._placementCoords( this._desiredCoords( o ) ) );
+ this._reposition( o );
}
},
@@ -553,8 +559,7 @@ define( [
},
_open: function( options ) {
- var coords,
- o = $.extend( {}, this.options, options ),
+ var o = $.extend( {}, this.options, options ),
// TODO move blacklist to private method
androidBlacklist = ( function() {
var w = window,
@@ -573,11 +578,6 @@ define( [
return false;
}());
- // Give applications a chance to modify the contents of the container before it appears
- this._trigger( "beforeposition" );
-
- coords = this._placementCoords( this._desiredCoords( o ) );
-
// Count down to triggering "popupafteropen" - we have two prerequisites:
// 1. The popup window animation completes (container())
// 2. The screen opacity animation completes (screen())
@@ -594,10 +594,10 @@ define( [
}
this._ui.screen.removeClass( "ui-screen-hidden" );
+ this._ui.container.removeClass( "ui-popup-hidden" );
- this._ui.container
- .removeClass( "ui-popup-hidden" )
- .offset( coords );
+ // Give applications a chance to modify the contents of the container before it appears
+ this._reposition( o );
if ( this.options.overlayTheme && androidBlacklist ) {
/* TODO:
Please sign in to comment.
Something went wrong with that request. Please try again.