             if totalPages > 0 { updateCurrentPage() }
         } else {
             let pageSize = isDirection(pageHeight, pageWidth)
-            
+            FolioReader.sharedInstance.readerContainer.updateChapterPosition(chapter: currentPage.pageNumber-1, position: Float(currentPage.webView.scrollView.contentOffset.y))
             if let page = currentPage
                 , page.webView.scrollView.contentOffset.forDirection()+pageSize! <= page.webView.scrollView.contentSize.forDirection() {
                 let totalWebviewPages = Int(ceil(currentPage.webView.scrollView.contentSize.forDirection()/pageSize!))

    }
    
    open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as! FolioReaderPage
        
        cell.centerDelegate = delegate

                let pageState = ReaderState(current: webViewPage, total: totalWebviewPages)
                delegate?.center?(pageDidChanged: currentPage, current: pageState.current, total: pageState.total)
            }


        }
        
        scrollScrubber?.scrollViewDidEndDecelerating(scrollView)
