代码之家  ›  专栏  ›  技术社区  ›  ADringer

如何知道启动滚动面板在底部?

  •  0
  • ADringer  · 技术社区  · 6 年前

    我使用priming ScrollPanel显示一些文本,我希望用户在按钮启用之前滚动到底部,以便他们继续。

    谢谢

    1 回复  |  直到 6 年前
        1
  •  0
  •   foxgang    6 年前

    您可以使用scrollTop方法。例子;

    <p-scrollPanel #sc [style]="{width: '100%', height: '200px'}">
                <div style="padding:1em;line-height:1.5">
                    The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding. His beloved
                    son Michael has just come home from the war, but does not intend to become part of his father's business. Through
                    Michael's life the nature of the family business becomes clear. The business of the family is just like the head
                    of the family, kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands
                    against the good of the family.
                    The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding. His beloved
                    son Michael has just come home from the war, but does not intend to become part of his father's business. Through Michael's
                    life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind
                    and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the
                    family.
                </div>
            </p-scrollPanel>
            <button (click)="sc.scrollTop(500)">Scroll bottom</button>
    
        2
  •  0
  •   Basma M. Mostafa    5 年前

    你可以改用virtualScroller,它没有滚动条位置检测,但是它有一个名为lazy scrolling的属性,当滚动条到达末尾时,你可以执行一个操作。