HTML Flip Book - v0.0.0-alpha.36
    Preparing search index...

    Core FlipBook class for creating realistic page-flip animations.

    import { FlipBook } from 'html-flip-book-vanilla';

    const flipBook = new FlipBook({
    pagesCount: 10,
    direction: 'ltr',
    });

    flipBook.render('#book-container');

    // Navigate programmatically
    await flipBook.flipNext();
    await flipBook.flipToPage(5);
    Index

    Constructors

    Properties

    bookElement?: HTMLElement
    touchDirectionLock: "none" | "vertical" | "horizontal" = "none"

    Direction lock for the current touch gesture. Once the first significant movement (>5 px) determines the dominant axis, the lock stays for the rest of the gesture. 'vertical' means native scroll wins — Hammer pan events are rejected. 'horizontal' means every touchmove gets preventDefault() so Hammer can drive the page flip.

    touchStartingPos: { x: number; y: number } = ...

    Accessors

    • get currentPageIndex(): number

      Get the index of the current (leftmost visible) page. Returns 0 if no pages are visible.

      Returns number

    • get isFirstPage(): boolean

      Check if the book is currently showing the first page(s).

      Returns boolean

    • get isLastPage(): boolean

      Check if the book is currently showing the last page(s).

      Returns boolean

    • get totalPages(): number

      Get the total number of pages in the flipbook.

      Returns number

    Methods

    • Clean up event listeners and Hammer instance. Should be called when the FlipBook is no longer needed.

      Returns void

    • Animate flip to the next page.

      Returns Promise<void>

      Promise that resolves when the flip animation completes

    • Animate flip to the previous page.

      Returns Promise<void>

      Promise that resolves when the flip animation completes

    • Animate to a specific page index. Flips through pages sequentially to reach the target.

      Parameters

      • pageIndex: number

        The target page index (0-based)

      Returns Promise<void>

      Promise that resolves when all flip animations complete

    • Download config (handlers and filename hints). Used by toolbar.

      Returns DownloadConfig | undefined

    • Get the configured table of contents page index.

      Returns number

    • Jump to a specific page instantly without animation.

      Parameters

      • pageIndex: number

        The target page index (0-based)

      Returns void

    • Parameters

      • selector: string
      • debug: boolean = false

      Returns void