使用Dart检测滚动到页面底部

时间:2015-08-20 11:32:47

标签: dart

我可以使用Javascript

检测到滚动到达底部
$(window).on("scroll", function() {
    var scrollHeight = $(document).height();
    var scrollPosition = $(window).height() + $(window).scrollTop();
    if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
        // when scroll to bottom of the page
    }
});

但我在Dart找不到document.height。 如何获得文档的高度并与window.scrollY进行比较?

1 个答案:

答案 0 :(得分:4)

我认为,虽然我总是无法理解各种高度,Module VBModule Public Function BeautifyXpath(ByVal s As String) As String Dim strBuilder As New System.Text.StringBuilder(s) If s.Contains("[") Then strBuilder.Replace("[%s]", "") strBuilder.Replace("@", "") Dim tokens = strBuilder.ToString().Split("/") For Each token In tokens Console.WriteLine(token) Next Return strBuilder.ToString() Else : Return s End If End Function Sub Main() Console.WriteLine(BeautifyXpath("/priorities/priority[%s]/@patternName")) End Sub End Module 应该有效(即我曾经使用过一次)

document.body.clientHeight

DartPad示例:https://dartpad.dartlang.org/6fcfb715e4090a1aafe4