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

[Solved] Autosize and center

3 Answers 104 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Pablo
Top achievements
Rank 1
Pablo asked on 19 Mar 2012, 08:13 PM
I have this code

winEdicion = $.telerik.window.create({
            name: "winEdicion",
            title: "Feed Edit",
            contentUrl: url,
            modal: true,
            visible: false,
            resizable: false,
            draggable: false,
            onClose: function (e) {
                e.preventDefault();
                winEdicion.data('tWindow').destroy();
            }
        });
        winEdicion.data('tWindow').center().open();

with this style

.t-window-content
{
    width: auto !important;
    height: auto !important;
}

The problem that I have is that the window is not center. To center it I have to add the code

onActivate: function (e) {
                    winMensajeAfirmacion.data('tWindow').center();
                },

but it makes an ugly effect.

Is there another way to open the window with autosize on the middle of the screen?

Thanks

3 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 22 Mar 2012, 03:39 PM
Hello Pablo,

The window needs to know its size in order to get centered on the screen. Since you are loading contents from a remote location, the size cannot be determined at first, so the window does not center. You can work around that if you wait for the refresh event (that is triggered when the window content loads) and showing (and centering) the window then.

All the best,
Alex Gyoshev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Pablo
Top achievements
Rank 1
answered on 22 Mar 2012, 04:10 PM
Alex. Thanks for your suggestion. It works perfect!!

Another question. If I test the site on Windows Phone the center function works perfect if the telephone is portrait. But if the telephone is landscape the center function put the window in the middle of the page and not in the middle of the window. So, if the page scrolls you can't see the window. Do you know any trick to handle with this situation?

Thanks for all.
0
Alex Gyoshev
Telerik team
answered on 23 Mar 2012, 08:22 AM

You can set the window offset with jQuery: $("#window").css("top", 10);

Does the issue occur in the desktop version of IE?

All the best,
Alex Gyoshev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
Window
Asked by
Pablo
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Pablo
Top achievements
Rank 1
Share this question
or