【问题标题】:kendo ui window not centering correctly剑道 ui 窗口未正确居中
【发布时间】:2014-05-20 11:35:58
【问题描述】:

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

这是一个演示问题的简单小提琴。所以剑道窗口在没有浏览器垂直滚动条的情况下有显示的空间,但是剑道窗口居中方法,将其置于中心位置,并强制浏览器滚动条出现。

小提琴: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();
});

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

【问题讨论】:

  • 不明白你想要什么。窗口正确居中,位于预览中心。详细解释。
  • 感谢您的回复。看我问题中的图片。 kendo 窗口没有垂直居中,因为它上面有空间,并且由于该空间,它使垂直滚动条出现在浏览器中,如图所示。如果剑道窗口垂直居中正确,顶部的空间会更少,并且浏览器中没有垂直滚动条。

标签: javascript kendo-ui kendo-window


【解决方案1】:

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

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

【讨论】:

  • 感谢您花时间解决这个问题。它确实给了我想要的结果。作为 Telerik 的付费客户,我想我也会提出官方支持请求,因为该组件确实应该开箱即用,无需此解决方法。感谢您的时间。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多