在dojotoolkit中滚动时,DIV会粘住

时间:2015-05-26 20:30:01

标签: scroll dojo

1 个答案:

答案 0 :(得分:0)

你确实可以为scroll事件创建一个事件处理程序并连续重新定位div,或者你只需​​使用CSS并将position: fixed添加到div。

例如:



body {
    min-height: 9000px;
}

.box {
    position: fixed;
    width: 100px;
    height: 100px;
    left: calc(50% - 50px);
    top: calc(50% - 50px);
    background: yellow;
}

<div class="box">Even when you scroll this box stays centered</div>
&#13;
&#13;
&#13;