                 }
                 // set default position of tabs and contents
                 tabScrollView.contentOffset = CGPoint(x: tabOffsetX + tabScrollView.contentInset.left * -1, y: tabScrollView.contentOffset.y)
-                contentScrollView.contentOffset = CGPoint(x: contentOffsetX, y: contentScrollView.contentOffset.y)
+                contentScrollView.contentOffset = CGPoint(x: contentOffsetX  + contentScrollView.contentInset.left * -1, y: contentScrollView.contentOffset.y)
                 
                 resetTabs()
             }

//   2. Infinite Scrolling
//   3. Performace improvement
//   4. Adjust the scrolling offset if tabs have diffent widths

import UIKit


    func scrollViewDidScroll(scrollView: UIScrollView) {
        if (scrollView == activeScrollView) {
            if (scrollView == tabScrollView) {
                contentScrollView.contentOffset.x = (tabScrollView.contentOffset.x + tabScrollView.contentInset.left) * (contentScrollView.contentSize.width / tabScrollView.contentSize.width) - contentScrollView.contentInset.left
            }
            
            if (scrollView == contentScrollView) {
                tabScrollView.contentOffset.x = (contentScrollView.contentOffset.x + contentScrollView.contentInset.left) * (tabScrollView.contentSize.width / contentScrollView.contentSize.width) - tabScrollView.contentInset.left
            }
            resetTabs()
        }
