admin管理员组

文章数量:1325385

I have an issue that the Kendo Window does not center correctly.

Here is a simple fiddle that demonstrates the issue. So there is room for the kendo window to show without the browser vertical scroll bar, but the kendo window center method, puts it off center, and forces the browsers scroll bar to appear.

Fiddle: /

HTML:

<div id="testWindow">
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
</div>

JavaScript:

$(document).ready(function() {
    var oWin = null;
    $('#testWindow').kendoWindow();
    oWin = $('#testWindow').data('kendoWindow');
    oWin.center();
});

Please show me how I can get the kendo window to center correctly.

I have an issue that the Kendo Window does not center correctly.

Here is a simple fiddle that demonstrates the issue. So there is room for the kendo window to show without the browser vertical scroll bar, but the kendo window center method, puts it off center, and forces the browsers scroll bar to appear.

Fiddle: http://jsfiddle/codeowl/QKPN6/2/

HTML:

<div id="testWindow">
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
    <p>here is the test content here is the test content</p>
</div>

JavaScript:

$(document).ready(function() {
    var oWin = null;
    $('#testWindow').kendoWindow();
    oWin = $('#testWindow').data('kendoWindow');
    oWin.center();
});

Please show me how I can get the kendo window to center correctly.

Share Improve this question asked May 20, 2014 at 11:35 user2109254user2109254 1,7593 gold badges33 silver badges53 bronze badges 2
  • Not understand what do you want. Window centered correctly, in center of preview. Explain in more details. – Magistr_AVSH Commented May 20, 2014 at 11:48
  • Thanks for responding. Look at the picture in my question. The kendo window is not centred vertically as there is space above it, and because of that space it makes the vertical scroll bar appear in the browser, as seen in the picture. If the kendo window vertically centred correctly there would be less space at the top, and no vertical scroll bar in the browser. – user2109254 Commented May 20, 2014 at 11:56
Add a ment  | 

1 Answer 1

Reset to default 8

I think the problem is solved :) Try.

$(document).ready(function() {
    var oWin = null;
    var h = window.innerHeight;
    $('#testWindow').kendoWindow({});
    oWin = $('#testWindow').data('kendoWindow');
    oWin.center().open();
    $('#testWindow').closest(".k-window").css({
        top: h/2 - $('#testWindow').parent()[0].scrollHeight/2
    });
});

JSFiddle

本文标签: javascriptkendo ui window not centering correctlyStack Overflow