 
     fileprivate var containerOpenSize: CGSize = .zero
     fileprivate var baseButtonOpenCenter: CGPoint = .zero
-    fileprivate var isOpen = false
     fileprivate var isAnimating = false
     fileprivate var animatedItemTag: Int = 0
+    
     fileprivate let superviewBoundsKeyPath = "layer.bounds"
     fileprivate var observesSuperviewBounds = false
+    fileprivate let scrollviewScrollKeyPath = "contentOffset"
+    fileprivate var observesScrollview = false
     
     fileprivate(set) var items = [UPActionButtonItem]()
     
     weak var delegate: UPActionButtonDelegate?
+    
+    var observedScrollView: UIScrollView? {
+        didSet {
+            if let scrollView = oldValue, observesScrollview {
+                scrollView.removeObserver(self, forKeyPath: scrollviewScrollKeyPath)
+                observesScrollview = false
+            }
+            if let scrollView = observedScrollView {
+                scrollView.addObserver(self, forKeyPath: scrollviewScrollKeyPath, options: .new, context: nil)
+                observesScrollview = true
+            }
+        }
+    }
+    
+    var isOpen = false
     
     /* Customization */
     var itemSize: CGSize = CGSize(width: 30, height: 30) {

        delegate?.actionButtonWillClose?(self)
        
        isAnimating = true
        isOpen = false
        animatedItemTag = 0
        
        reduceItems()

    
    func transitionButtonTitle() {
        let duration = animationDuration / 2.0
        let opening = !isOpen
        
        switch transitionType {
        case .none: break
            
        case .rotate(let angle):
            guard let titleView = self.visibleOpenTitleView else { return }
            UIView.animate(withDuration: duration, delay: 0.0, usingSpringWithDamping: 0.7, initialSpringVelocity: 5.0, options: .curveEaseInOut, animations: {
                titleView.transform = opening ? CGAffineTransform(rotationAngle: angle) : CGAffineTransform.identity
            }, completion: nil)
            
        case .crossDissolveText(let title):
            if opening {
                closedTitleLabel.text = title
            }
            closedTitleLabel.isHidden = false
            visibleOpenTitleView?.isHidden = false
            UIView.animate(withDuration: duration, animations: {
                self.visibleOpenTitleView?.alpha = opening ? 0.0 : 1.0
                self.closedTitleLabel.alpha = opening ? 1.0 : 0.0
            }, completion: { (finished: Bool) in
                self.visibleOpenTitleView?.isHidden = opening
                self.closedTitleLabel.isHidden = !opening
            })
            
        case .crossDissolveImage(let image):
            if opening {
                closedTitleImageView.image = image
            }
            closedTitleImageView.isHidden = false
            visibleOpenTitleView?.isHidden = false
            UIView.animate(withDuration: duration, animations: {
                self.visibleOpenTitleView?.alpha = opening ? 0.0 : 1.0
                self.closedTitleImageView.alpha = opening ? 1.0 : 0.0
            }, completion: { (finished: Bool) in
                self.visibleOpenTitleView?.isHidden = opening
                self.closedTitleImageView.isHidden = !opening
            })
        }
    }
