PDA

View Full Version : Reset Scroll bars in DHTML Window?



mag3
09-23-2011, 02:31 PM
1) Script Title: DHTML Window widget (v1.1)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

3) Describe Question: If scrolling is enabled on a window instance (i.e. "scrolling=1"), is there a way to force the scroll bars to the left/top as the window instantiates?

For example, a user clicks on a link in the general page and instantiates a window with this widget. By default, the window has the scroll bars at the top and leftmost positions. The user can scroll to the bottom of the window (only concerned with Vertical scrolling here), where they'll find a "close" button that invokes the "close()" method of the widget. The window instance then closes, with the scroll bars left where they were last positioned.

If the user then clicks on a 2nd link that instantiates a different window (i.e. with different, *shorter* vertical content), the window opens, but the scroll bar is left in the same position as the previous window instance (ie. at the bottom, with only the lower content visible - in this case, just a "close" button). The user might not realize they have to scroll back up to get the other content.

Is there a setting to force the newly opened window instance to reposition it's scroll bars to the top? And yes, the "close" button I mention needs to be at the bottom of the content. :D

Thanks & Regards,
mag3

ddadmin
09-23-2011, 11:55 PM
Are the two windows separate instances of DHTML window? If so the scrollbar position of one window upon closing shouldn't have any bearing on that of the other.

mag3
09-24-2011, 05:15 PM
Are the two windows separate instances of DHTML window? If so the scrollbar position of one window upon closing shouldn't have any bearing on that of the other.

Only one instance. Well, one variable set, anyway (the default, "ajaxwin" etc.). I guess I could create addl. variables as you suggest. I just hope it doesn't take too much extra RAM. Or, perhaps, is there a parameter one can specify in the close() method to make that instance "self-destruct" and free the RAM, so a brand new instance must be created at each dhtmlwindow.open() event? I have twelve different potential pop up windows that could open (only one at a time, though). Nine of them have exactly the same content length. I could create one variable set for those, and another for those of the larger content length.

Thanks. I'll give the "multiple variables" thing a try and keep you posted. :)