If you want offsets use .offset() not .position().

On Nov 30, 8:23 am, Charles H <charles.har...@gmail.com> wrote:
> In our framework, there may be multiple jqueryUI dialogs resulting
> from one ajax transaction. I would like to be able to ensure that
> dialogs do not overlap each other exactly by offsetting the x and y of
> each additional dialog by 10 pixels. The trouble is, I can't seem to
> get a real viewport y and y from the already existing dialogs. I've
> tried getting .position(), which only gives me 'center', also tried
> position().left, which seems to give me the left from some relative
> div, not the viewport. Nothing that I have tried seems to give me the
> correct viewport top and left of the previous dialog. Here is some
> pseudocode:
>
>  // The current dialog, which has already been instantiated as
> centered but not yet shown.
>  var currentWindow = etc...
>
>   // If there is already a dialog open, shift currentWindow by 10
> pixels Y and X
>   if (this.fastJqueryUiWindows.length>0) {
>
>     // Get the previously opened window
>     var previousWindow = this.fastJqueryUiWindows
> [this.fastJqueryUiWindows.length - 1];
>     if (! previousWindow){
>       return;
>     }
>
>     // Here is where I need the x and y from the viewport, so that
> repositioning will be correct.
>     var x = previousWindow.position().left + 10;
>     var y = previousWindow.position().top + 10;
>
>     // Set the x and y of the new dialog to be 10 px offset frmo
> underlying window.
>     currentWindow .dialog('option', 'position', [x, y]);
>
>   }
>
>  The dialog always ends up at far screen left because position().left
> and top seem to reflect something other than the x and y on the
> viewport...
>
> Any suggestions would be greatly appreciated!
>
> Thanks,
> Charles Harvey

--

You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to jquery...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-ui+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.


Reply via email to