This is a migrated thread and some comments may be shown as answers.

How to center a window in the fixed position?

2 Answers 211 Views
Window
This is a migrated thread and some comments may be shown as answers.
Eugeny
Top achievements
Rank 1
Eugeny asked on 15 Dec 2009, 07:45 AM
How to center a window in the fixed position?
The RadWindow should remains on the centre of browser window during page scrolling.

2 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 15 Dec 2009, 08:05 AM
Hi Ivan Petrov, 

What you need can easily be accomplished with a two CSS selectors applied to the wrapping element of RadWindow:

<style type="text/css">
.RadWindow
{
 position: fixed !important; /* all browsers in standards-compliance mode */
}

* html div.RadWindow
{
 position: absolute !important; /* IE6 and IE7/8 in quirks mode */
}
</style>

 
Please, keep in mind that Internet Explorer 6 does not support CSS position: fixed (and more - if your page is non-xhtml, this will not work in IE7 and IE8 as well), so the code above will be ignored by that particular version and the rendering will be handled by the second selector (the one with the * html hack). Also - make sure you do not remove the !important flag at the end of the property value, because otherwise you will not be able to force your custom setting, and the window will persist its absolute position instead of getting fixed.

Sincerely yours,
Martin Ivanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Eugeny
Top achievements
Rank 1
answered on 15 Dec 2009, 08:20 AM
Thanks a lot, Martin! Nice solution.

But, unfortunately, it have problem.
If to scroll down browser window (RadWindow stay in fixed position), and then to try drag-and-drop a RadWindow ...

If document.body.scrollTop is more than zero, RadWindow drag-and-drop works incorrectly (with css style -  position: fixed).
Tags
Window
Asked by
Eugeny
Top achievements
Rank 1
Answers by
Martin
Telerik team
Eugeny
Top achievements
Rank 1
Share this question
or