WKwebview监听滚动高度

原生控制器
self.webView.addObserver(self, forKeyPath: "scrollView.contentSize", options: NSKeyValueObservingOptions.new, context: nil)

override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
    print("监听网页滚动")
}

web页面
js监听滚动位置

你可能感兴趣的:(WKwebview监听滚动高度)