views:

36

answers:

1

This may be due to my ignorance but when using jQuery UI dialog boxes, how do I ensure that the dialog box moves in relation to the way the browser gets scrolled horizontally and vertically. We have an application that has a lot of horizontal text boxes on it and to see them all, a user would have to scroll horizontally. If no scrolling occurs, the inital textbox is displayed fine but if you scroll the browser horizontally, the dialog box is off its desired location by that same amount of horizontal scrolling. Do I need to set some relative window positioning for the UI dialog and if so, how would I do this?

Thank you, M

+1  A: 

Does this help? Is it what you are looking for?

<html>
<head>
<title>TextArea Position Handling Test</title>
</head>
<body>
<center>
  <textarea style="position: relative"> Insert Text</textarea>
</center>
</body>
</html>

EDIT:

Please read this tutorial:

http://www.dailycoding.com/Posts/creating_always_visible_div_using_css.aspx

Is this what you are looking for?

EDIT 2:

Is this roughly what you needed?

http://css-tricks.com/examples/ScrollingSidebar/

Trufa
That might be part of it. When I scroll the browser window horizontally, the UI dialog box does not reposition itself as I scroll. I need the dialog box to scroll in accordance with the browser.
Matthew
@Matthew please look at my edit!
Trufa
I liked your edit but that contains 'fixed' position whereas I need the modal window to move when the browser window gets scrolled, probably just a small modification to your edit. I'll look at it again.
Matthew
Could you give me and working similar example of what you need Im not sure I follow...
Trufa
Ohh look at my edit
Trufa
Can you give me a link to the application, I´m sorry but I cant imagine what you mean! :)
Trufa
Thank you, that is closer to the idea. Basically, we have an application that has so many text boxes in a row that users are forced to scroll horizontally to see all the fields. Many of the text boxes are clickable. So if it is a car, you would have manufactuer, make, color, license plate. Each text box that is clickable has a jQuery UI dialog box appear right below it showing a drop down menu selection. So for color, you could pick red, green, blue... If a user scrolls from left to right, the dialog box no longer appears directly below the clickable textbox.
Matthew
Ohh ok, I think I got you now, let me see if I can figure something out, please make an edit to your question adding some example code because if now I will have to recreate your situation and then solve it, I maybe could give you a theoretical answer but I dont know if this would help.
Trufa
I got it working, I just needed to offset when a user scrolled so something like var correct = $(this).scrollLeft(); fixes the scrolling problem. Thank you for your help.
Matthew