ali mousavi
ali mousavi

Reputation: 51

Open popup center of the pattern in kendo ui

I have iframe in my page, in the iframe I have a button which should open window in center of my page.

$(function () {
        var offset = 0;
        var windowWidth = $(document).width();
        var parametrs = '[email protected]&[email protected]';
        var popupWindow = $(".popupWindow").each(function () {
            var popupWindows = $(this).kendoWindow({
                iframe: true,
                width: $(document).width() - 25,
                height: 300,
                resizable: false,
                draggable: false,
                actions: ["Minimize", "Maximize", "Close"],
                visible: false,
                content: '@Url.Action("Index", "Editor")?' + parametrs,

            }).data('kendoWindow');

            var parent = $(this).parent();
            parent.css("top", parent.offset().top + offset);
            offset += parent.outerHeight();
            popupWindows.open();


        });
        $("#container").sortable();
    });

I use kendo ui window.

Upvotes: 1

Views: 2444

Answers (2)

jonni
jonni

Reputation: 338

$(function () {
    var offset = 0;
    var windowWidth = $(document).width();
    var parametrs = '[email protected]&[email protected]';
    var popupWindow = $(".popupWindow").each(function () {
        var popupWindows = $(this).kendoWindow({
            iframe: true,
            width: $(document).width() - 25,
            height: 300,
            resizable: false,
            draggable: false,
            actions: ["Minimize", "Maximize", "Close"],
            **open : function() { this.center(); }**
            visible: false,
            content: '@Url.Action("Index", "Editor")?' + parametrs,

        }).data('kendoWindow');

        var parent = $(this).parent();
        parent.css("top", parent.offset().top + offset);
        offset += parent.outerHeight();
        popupWindows.open();


    });
    $("#container").sortable();
});

Add the function for open which is triggered every time the popup is opened. In this function use center() thus placing your popup at the center of the page every time you open it.

Or you can simple use the statement popupWindows.center() after popupWindows.open() statement.

Upvotes: 0

Logard
Logard

Reputation: 1513

popupWindows.center() will center your popup.

Upvotes: 1

Related Questions