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

Modal Window with fixed width not centered when the window is resized

1 Answer 144 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 10 Sep 2013, 08:53 PM
My application features many modals, all with different widths. I understand you can set the width of a modal inline by doing something like:width: 400px margin-left: -200px;This works when the window is at 100%, but if you resize the window and it gets down to a small enough width the window is now -200px off of the screen. If I don't use margin-left: -200px then the window is not centered on the page at all.

In summary, I want to be able to set different widths to my modal windows, have them center on the screen when opened, and if the screen is resized the modal window needs to slide and stay in the center of the screen.

There has to be a more effieicent way to center these modal windows...

Any help is greatly appreciated.


1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 11 Sep 2013, 07:29 AM
Hello Jon,

Using margins is not required to make Kendo UI Windows centered. There is a center() API method for that. You can execute this method when opening Kendo UI Window instances or in the browser window's resize event to achieve the desired behavior.

http://demos.kendoui.com/web/window/api.html

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
General Discussions
Asked by
Jon
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or