     fileprivate var maskImageView: UIImageView!
     fileprivate var titleLabel: UILabel!
     fileprivate var imgLabel: UILabel!
+    fileprivate var preLabel: UILabel!
+    fileprivate var nextLabel: UILabel!
+    fileprivate var indicatorView: UIActivityIndicatorView!
+}
+
+extension MPWebView: WKNavigationDelegate {
+    
+    func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
+        indicatorView.startAnimating()
+        decisionHandler(.allow)
+    }
+    
+    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
+        indicatorView.stopAnimating()
+        webView.evaluateJavaScript("document.body.scrollHeight") { (result, error) in
+            if let height = result as? CGFloat {
+                self.nextLabel.frame.origin.y = height + 50
+            }
+        }
+    }
+    
+    func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
+        indicatorView.stopAnimating()
+    }
 }
 
 

                    self.topImageView.kf.setImage(with: URL(string: urlString))
                }
                self.titleLabel.text = model.title
                if let source = model.image_source {
                    self.imgLabel.text = "图片:\(source)"
                }

        imgLabel.font = UIFont.systemFont(ofSize: 10)
        imgLabel.textAlignment = .right
        imgLabel.textColor = UIColor.white
        preLabel = UILabel()
        preLabel.textAlignment = .center
        preLabel.text = "载入上一篇"
        preLabel.textColor = UIColor.white
        nextLabel = UILabel()
        nextLabel.textAlignment = .center
        nextLabel.text = "载入下一篇"
        nextLabel.textColor = UIColor.black
        
        indicatorView = UIActivityIndicatorView(activityIndicatorStyle: .gray)
        
        scrollView.addSubview(topImageView)
        scrollView.addSubview(maskImageView)
        scrollView.addSubview(titleLabel)
        scrollView.addSubview(imgLabel)
        scrollView.addSubview(preLabel)
        scrollView.addSubview(nextLabel)
        scrollView.addSubview(indicatorView)
        
        topImageView.frame = CGRect.init(x: 0, y: 0, width: screenW, height: 200)
        maskImageView.frame = CGRect.init(x: 0, y: 100, width: screenW, height: 100)
        titleLabel.frame =  CGRect.init(x: 15, y: 150, width: screenW - 30, height: 26)
        imgLabel.frame = CGRect.init(x: 15, y: 180, width: screenW - 30, height: 16)
        preLabel.frame = CGRect.init(x: 15, y: -30, width: screenW - 30, height: 20)
        nextLabel.frame = CGRect.init(x: 15, y: screenH + 30, width: screenW - 30, height: 20)
    }
    
    required init?(coder: NSCoder) {
        fatalError("")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        indicatorView.center = self.center
    }
    
    // MARK: - View
