     }
 
     private func scrollUrlBar(dy: CGFloat) {
-        let newY = clamp(header.transform.ty + dy, min: -header.frame.height, max: 0)
+        let newY = clamp(header.transform.ty + dy, min: -ToolbarHeight, max: 0)
         header.transform = CGAffineTransformMakeTranslation(0, newY)
+        urlBar.alpha = (1 - newY / -ToolbarHeight)
     }
 
     private func scrollToobar(dy: CGFloat) {

    private func showToolbars(animated: Bool) {
        UIView.animateWithDuration(animated ? 0.5 : 0.0, animations: { () -> Void in
            self.header.transform = CGAffineTransformIdentity
            self.footer.transform = CGAffineTransformIdentity
            // Reset the insets so that clicking works on the edges of the screen
            if let tab = self.tabManager.selectedTab {


                if let tab = self.tabManager.selectedTab {
                    let inset = tab.webView.scrollView.contentInset
                    let newInset = clamp(inset.top + delta.y, min: StatusBarHeight, max: ToolbarHeight + StatusBarHeight)

                    tab.webView.scrollView.contentInset = UIEdgeInsetsMake(newInset, 0, clamp(newInset - StatusBarHeight, min: 0, max: ToolbarHeight), 0)
                    tab.webView.scrollView.scrollIndicatorInsets = UIEdgeInsetsMake(newInset - StatusBarHeight, 0, clamp(newInset, min: 0, max: ToolbarHeight), 0)

                    // Adjusting the contentInset will change the scroll position of the page.
                    // We account for that by also adjusting the previousScroll position
