Product Docs

Flippy 3D Flipbook Documentation

Flippy transforms static PDFs into an immersive, WebGL-powered flipbook experience with page physics, lightbox delivery, and drop-in customization. This guide walks through setup, configuration, customization, and troubleshooting so you can ship premium flipbook experiences fast.

1. Project overview

Flippy is a front-end template that showcases a 3D flipbook viewer with WebGL acceleration, built-in lightbox and drop-zone demos, and Tailwind-friendly styling. The project ships as a static site (no build toolchain required) but includes optional scripts and ES module wrappers so you can integrate it with modern bundlers.

Core technologies

  • WebGL rendering for realistic page flips
  • jQuery-driven initialization (ES module friendly)
  • Tailwind utility classes compiled into style.css
  • TouchSwipe for gesture support
  • Screenfull for fullscreen toggles

Key capabilities

  • Embed demo (in-page viewer)
  • Lightbox + preset viewer demo
  • Drag-and-drop PDF import
  • Theme switcher with persisted preference
  • Mobile navigation drawer with focus management

2. System requirements

The documentation uses plain HTML/CSS/JS and can be opened directly in a browser. For local development we recommend:

Requirement Recommended version
Node.js >= 18 (only required if you install additional tooling)
Modern browser Chrome 112+, Edge 112+, Safari 16+, Firefox 110+
Hardware GPU acceleration recommended for smooth WebGL playback

3. Quick start

  1. Install dependencies (optional): If you plan to use a bundler or run linting, install packages with npm install. The static demo works without this step.
  2. Serve the site: Open index.html directly or run a static server (for example npx serve .) to ensure module imports resolve.
  3. Load PDFs: Keep sample PDFs in /books. Update paths inside index.js if you rename or add new files.
  4. Customize: Adjust Tailwind classes in index.html or extend utilities in style.css. Review the customization section for viewer options.
Note: Serving the project via file:// can break module imports in some browsers. Prefer a local HTTP server.

4. Project structure

flippy/
├─ books/                # Sample PDFs
├─ docs/                 # Documentation (this file)
├─ public/               # Static assets (icons, images)
├─ src/                  # ES modules (jQuery, Flippy, helpers)
│  ├─ flippy.js          # Core viewer logic
│  ├─ flippy.webgl.js    # WebGL rendering engine
│  ├─ flippy.pdfservice.js# PDF.js integration
│  ├─ screenfull.js      # Fullscreen helper
│  ├─ touchswipe.js      # Gesture support
│  ├─ ...                # Additional vendor modules
├─ index.html            # Landing page with live demos
├─ index.js              # Entry point that wires demos together
├─ style.css             # Tailwind compiled stylesheet
└─ package.json          # Optional scripts / metadata

5. Available scripts

The template intentionally keeps scripts minimal. Suggested commands:

Command Description
npm install Install dependencies if you plan to use tooling (optional).
npx serve . Serve the project over HTTP for local development.
npx prettier --write "**/*.html" Format documentation or additional HTML files.

6. Live demo widgets

All demos are initialized inside index.js after the core modules finish loading. Each call uses the same flippyBook API with different options.

Embedded viewer

Renders inline within the page, ideal for product tours.

jQuery("#flippyEmbedExample").flippyBook({
  pdfUrl: "./books/book.pdf",
  textLayer: true
});

Lightbox + preset viewer

jQuery("#flippyLightboxExample").flippyBook({
  pdfUrl: "./books/book02.pdf",
  textLayer: true,
  lightBox: true
});

jQuery("#flippySelectedExample").flippyBook({
  pdfUrl: "./books/book02.pdf",
  textLayer: true,
  lightBox: true
});

Both buttons target the same PDF with slightly different entry points, letting stakeholders compare triggers.

Drop zone demo

jQuery("#flippyDropZoneExample").flippyBook({
  textLayer: true,
  lightBox: true,
  dropZone: {
    enabled: true,
    statusSelector: ".flippy-dropzone-status"
  }
});

The drop zone accepts PDF files, opens them in a lightbox, and updates the status element to indicate success or validation errors.

7. Customization

Viewer options

The flippyBook initializer accepts a single configuration object. Options are additive; unspecified values fall back to sensible defaults.

Option Type Default Description
pdfUrl string null Absolute or relative path to the PDF to render. Required unless images is supplied.
images string[] [] Array of image URLs for image-only flipbooks. Overrides pdfUrl when provided.
lightBox boolean false Opens the viewer in a modal lightbox overlay instead of inline.
textLayer boolean true Enables PDF.js selectable text overlay. Disable for image-only catalogs.
sound boolean true Controls page flip audio effects. Toggle off for silent experiences.
autoPlay boolean false Automatically advances pages on load. Often combined with autoPlayInterval.
autoPlayInterval number 5000 Delay in milliseconds between automatic page turns when autoPlay is true.
pageShadow boolean true Toggles dynamic shadows during page turns. Disable for maximum performance.
scale number 1 Global scale multiplier for the viewer canvas. Useful when embedding in smaller containers.
thumbs boolean true Displays the thumbnail sidebar/navigation when supported.
bookmarks boolean true Enables table-of-contents/bookmark sidebar from PDF outline metadata.
dropZone.enabled boolean false Turns the target element into a drag-and-drop area for local PDFs.
dropZone.statusSelector string null CSS selector used to display drop-zone status and errors.
callbacks.onReady function () => {} Invoked when the viewer has finished initializing.
callbacks.onPageChange function (page) => {} Fires whenever the current page changes, receiving the new page index.
callbacks.onError function (error) => console.error(error) Called when the viewer encounters an unrecoverable error (missing PDF, parsing error, etc.).

Sample configuration

$("#marketingLookbook").flippyBook({
  pdfUrl: "/media/lookbook.pdf",
  lightBox: false,
  textLayer: true,
  pageShadow: false,
  autoPlay: true,
  autoPlayInterval: 7000,
  dropZone: {
    enabled: false
  },
  callbacks: {
    onReady: () => console.log("Viewer ready"),
    onPageChange: (page) => analytics.track("flipbook:page", { page })
  }
});

Common tweaks

8. Branding & theming

All styling is Tailwind-compatible. To adjust colors globally, edit Tailwind variables in style.css or replace utility classes in index.html.

Dark mode persistence

The theme toggle writes the user choice to localStorage under the key flippy-theme. To change the default theme, update the inline script in index.html.

Gradient sections

Hero and drop-zone sections use layered gradient backgrounds defined directly in the markup. Adjust gradient colors to match your brand palette.

9. Embedding Flippy elsewhere

To embed the viewer into another project:

  1. Copy the contents of src/, books/, style.css, and the relevant HTML snippet.
  2. Ensure jquery.module.js (or your own jQuery entry) is available.
  3. Call flippyBook on your target element after the DOM is ready.
<link rel="stylesheet" href="/path/to/style.css" />
<div id="myFlipbook"></div>
<script type="module">
  import $ from "/path/to/jquery.module.js";
  import "/path/to/flippy.js";
  import "/path/to/flippy.webgl.js";
  // ...other modules

  $("#myFlipbook").flippyBook({
    pdfUrl: "/documents/proposal.pdf",
    lightBox: false,
    textLayer: true
  });
</script>

10. Analytics & events

The base project does not ship analytics, but Flippy exposes callbacks via jQuery events:

$("#flippyEmbedExample").on("flippy:pageChange", (_, page) => {
  console.log("User navigated to page", page);
});

11. Monetization patterns

Flippy does not prescribe a payment provider but supports common patterns:

12. Accessibility

13. Performance tips

14. Troubleshooting

Error: require is not defined

Legacy plugins expect CommonJS. The project shims require in index.js. Ensure you serve the ES module bundle and do not remove the shim block.

PDF fails to load

  • Check console for CORS errors (serve via HTTP, not file://).
  • Verify the pdfUrl path and file extension.
  • Validate that the PDF is not password-protected (Flippy cannot unlock protected files).

Slow performance

15. Frequently asked questions

Can I load images instead of PDFs?

Yes. Provide an array of image URLs via the Flippy configuration (see flippy.js docs inside the source for images mode).

Does Flippy support mobile?

TouchSwipe powers gesture controls, and the layout is responsive. Always test on real devices to confirm performance.

How do I change icons?

Icons are loaded from /icons/unicon-*.css. Replace with your preferred icon font and update classes in the HTML or Flippy templates.

16. Support & next steps

If you extend the project: