是否可以在滚动区域外的div上滚动?

时间:2019-05-14 20:05:40

标签: javascript jquery css css3 scroll

我在页面上有固定高度的可滚动内容。当我滚动页面时,我想在div上滚动,然后到达页脚。是否可以像这样滚动到视图之外? div的高度是动态计算的,我无法更改。

以下是可滚动div的高度代码:

private void createRightSide(Composite mainComposite) {
    ScrolledComposite detailsSC = new ScrolledComposite(mainComposite, SWT.SMOOTH | SWT.BORDER | SWT.V_SCROLL);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    detailsSC.setLayoutData(gd);
    detailsSC.setLayout(new GridLayout(1, true));
    detailsSC.setExpandHorizontal(true);
    detailsSC.setExpandVertical(true);

    Composite detailsComposite = new Composite(detailsSC, SWT.NONE);
    detailsComposite.setLayout(new GridLayout(2, false));
    GridData gdd = new GridData(SWT.FILL, SWT.FILL, true, true);
    detailsComposite.setLayoutData(gdd);

    Label dmyLabel = new Label(detailsComposite, SWT.NONE);
    GridData labelData = new GridData();
    dmyLabel.setLayoutData(labelData);
    dmyLabel.setText("Dummy");

    detailsSC.setContent(detailsComposite);       
    detailsSC.setMinSize(detailsComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

谢谢

0 个答案:

没有答案