javascript - kendo ui 窗口没有正确居中

标签 javascript kendo-ui kendo-window

我有一个问题,Kendo 窗口没有正确居中。

这是一个演示问题的简单 fiddle 。所以在没有浏览器垂直滚动条的情况下,kendo 窗口有显示的空间,但是 kendo 窗口居中方法,将其偏离中心,并强制浏览器滚动条出现。

enter image description here

fiddle :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>

JavaScript:

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

请告诉我如何让剑道窗口正确居中。

最佳答案

我认为问题已经解决了:)试试。

$(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

关于javascript - kendo ui 窗口没有正确居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23758731/

相关文章:

javascript - 当我们在剑道网格中已经实现了编辑选项时如何添加动态行(列中有下拉列表)

javascript - 如何设置 Kendo 窗口的内容?

jquery - KendoWindow 第一次打开时可以关闭,但第二次打开时则不能关闭

javascript - 检查我的 php BD 上是否存在元素并将其显示在 html 上

javascript - 如何在 jquery 中切换多个图像?

kendo-ui - 带有复选框的 Kendo TreeList

javascript - 您如何访问 'Select All' 复选框?

jquery - Kendo UI窗口关闭事件: prevent window close

JavaScript 附加子项

javascript - 如何判断模板中的模型是否是新的?