剑道ui窗口没有​​正确居中

use*_*254 3 javascript kendo-ui kendo-window

我有一个问题,剑道窗口没有正确居中.

这是一个简单的小提琴,演示了这个问题.因此,在没有浏览器垂直滚动条的情况下,kendo窗口可以显示空间,但是kendo窗口中心方法会将其置于中心位置,并强制浏览器滚动条显示.

在此输入图像描述

小提琴:http://jsfiddle.net/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>
Run Code Online (Sandbox Code Playgroud)

JavaScript的:

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

请告诉我如何让kendo窗口正确居中.

Mag*_*VSH 7

我认为问题解决了:)试试.

$(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
    });
});
Run Code Online (Sandbox Code Playgroud)

的jsfiddle

  • 感谢您抽出宝贵的时间来解决这个问题.它确实给了我想要的结果.作为Telerik的付费客户,我想我也会提出正式的支持请求,因为组件应该开箱即用,而不需要这种解决方法.感谢你的时间. (2认同)