Real3D Flipbook JS
Real3D Flipbook JS turns a PDF or a set of images into a flipbook on any web page or web app. It is plain JavaScript with no dependencies. This guide covers installing, activating your license, creating flipbooks, every option, interactive pages and the JavaScript API.
What's in the zip
| Folder | What it is |
|---|---|
build/ | The flipbook: js/, css/ and assets/. Upload this folder to your site. |
examples/ | Ready-to-use HTML pages that load the files from build/. Copy one as a starting point. |
changelog.txt | What changed in each version. |
The CodeCanyon download also contains src/, the same scripts unminified.
Activate your license
The flipbook needs an active license on each domain where it runs. You can test on localhost without activating.
Bought on real3dflipbook.com
- Open verify.real3dflipbook.net/js.
- Enter your license key. It starts with
sk_and is in your purchase email and your account. - Enter your domain, for example
example.com, and click Activate.www.example.comandexample.comcount as one domain.
Bought on CodeCanyon
- Open verify.real3dflipbook.net and sign in with your Envato account.
- Enter your domain and click Activate.
To move a license to another domain, click Deactivate next to the old domain first, then activate the new one.
Install
- Upload the contents of
build(js,css,assets) to a folder on your site, for example/flipbook/. - Add the stylesheet and the script to your page:
<link rel="stylesheet" href="/flipbook/css/flipbook.min.css"> <script src="/flipbook/js/flipbook.min.js"></script> - Add an element for the flipbook and create it with
new FlipBook(element, options)(next sections).
build/js together. flipbook.min.js loads the other files (the view modes, the PDF reader, the 3D engine) from the same folder only when they are needed.Point the page-turn sound at your folder with the assets option: assets: { flipMp3: "/flipbook/assets/mp3/turnPage.mp3" }.
jQuery is not needed. If your site uses it, $("#container").flipBook(options) works too.
PDF flipbook
<div id="container" style="height:600px"></div>
<script>
document.addEventListener("DOMContentLoaded", function () {
new FlipBook(document.getElementById("container"), {
pdfUrl: "/files/brochure.pdf",
name: "Brochure 2026"
});
});
</script>The flipbook fills the container, so give the container a height (or let responsiveContainer size it, which is on by default). Pages load as they are read, links in the PDF work, and the text can be searched and selected.

The PDF must be on the same domain as the page, or on a server that allows cross-origin requests (see Troubleshooting).
Image flipbook
new FlipBook(document.getElementById("container"), {
pages: [
{ src: "book/1.jpg", thumb: "book/thumb1.jpg", title: "Cover" },
{ src: "book/2.jpg", thumb: "book/thumb2.jpg" },
{ src: "book/3.jpg", thumb: "book/thumb3.jpg", title: "Chapter 1" }
]
});Each page takes:
| Key | What it does |
|---|---|
src | The page image (JPG or WebP). |
thumb | A small version for thumbnails. It is also shown while src loads. |
srcSmall, srcLarge | Optional smaller and larger versions. srcSmall is used for pages loaded ahead and when the page is small on screen; srcLarge when the reader zooms in past the size of src. |
title | Adds the page to the table of contents. |
json | Text and links of the page, as made by the PDF to Image Converter, so search and links work in an image flipbook. |
items, htmlContent | Links, hotspots, video and other content on the page (see Page items). |
Update
- Download the latest version: from the link in your purchase email or your account (real3dflipbook.com), or from Downloads on CodeCanyon.
- Replace the
js,cssandassetsfolders on your site with the new ones frombuild.
Your license stays active. Browsers cache scripts, so add a version to the URLs if readers might keep the old files, for example flipbook.min.js?v=5.9.
Lightbox
With lightBox: true, the element you pass becomes the trigger: a click opens the flipbook over the page. Pass several elements to let any of them open it. Pages load only when the lightbox opens, so a page can hold many lightbox books.
<img id="cover" src="covers/brochure.jpg" alt="Brochure">
<a class="read-brochure" href="#">Read the brochure</a>
<script>
new FlipBook(document.querySelectorAll("#cover, .read-brochure"), {
pdfUrl: "/files/brochure.pdf",
lightBox: true
});
</script>

Add data-page="5" to a trigger to open the book on that page. Other lightbox options: lightBoxOpened (open on page load), lightBoxFullscreen (open in fullscreen), lightboxStartPage, lightboxBackground, lightboxMarginV, lightboxMarginH, lightboxPreload (load before the first click) and lightboxCloseOnBack (the browser Back button closes it).
View modes
Set viewMode:
| Value | How pages move |
|---|---|
webgl (default) | Real 3D: pages bend with light and shadow. |
3d | CSS 3D page turn. |
2d | Flat page turn. |
swipe | Pages slide sideways, like a phone gallery. |
scroll | Pages scroll top to bottom, like a PDF viewer. |
simple | No animation; the book fades between pages. |

webgl and scroll mode.singlePageMode: true shows one page at a time instead of spreads. pageFlipDuration sets the turn speed in seconds (default 1).
Toolbar layouts
Set layout to one of ten toolbar layouts:
| Value | Layout | Value | Layout |
|---|---|---|---|
1 | Bottom bar (default) | 6 | Minimal |
2 | Top corners | 7 | Player |
3 | Top bar | 8 | Pill |
4 | Top pill | 9 | Left rail |
5 | Bottom corners | 10 | Right rail |

On phones the rail layouts switch to the Pill. Other toolbar options: progressBar: { enabled: true } adds a progress bar, menuAutoHide: true hides the toolbar on phones and tablets after a few seconds (a tap shows it again), hideMenu: true hides it completely, and iconSet picks "fontawesome" (solid) or "lucide" (outline) icons.
Skins and colors
Set skin to "light", "dark" or "gradient", and add glass: true for frosted toolbars and panels on the light and dark skins.

Fine-tune colors with backgroundColor (or backgroundImage, backgroundPattern, backgroundTransparent), accentColor, skinColor and skinBackground for the toolbar, btnColor, btnBackground, btnSize, btnRadius for buttons, floatingBtn* for buttons over the book, and arrow* for the side arrows. All are in the options table.
Add a dark mode switch to the More menu with btnDarkMode: { enabled: true }.
Toolbar buttons
Every button has its own option object. Turn a button off, rename it, move it, or put it in the More menu:
new FlipBook(el, {
pdfUrl: "/files/brochure.pdf",
btnPrint: { enabled: false },
btnDownloadPdf: { title: "Get the PDF", url: "/files/brochure-print.pdf" },
btnShare: { hAlign: "right" },
btnSound: { toolsMenu: true }
});| Button | Default | Button | Default |
|---|---|---|---|
currentPage | on | btnBookmark | on |
btnFirst, btnLast | on, in More | btnAutoplay | on |
btnPrev, btnNext | on | btnShare | on |
btnZoomIn, btnZoomOut | on | btnPrint | on, in More |
btnThumbs | on | btnDownloadPdf | on, in More |
btnToc | on | btnDownloadPages | on, in More |
btnSearch | on | btnSound | on, in More |
btnSingle | on, in More | btnDarkMode | off |
btnExpand (fullscreen) | on | btnRotateLeft, btnRotateRight | off |
Button keys: enabled, title (tooltip), hAlign (left, center, right), vAlign (top, bottom), toolsMenu (in the More menu). btnOrder is the list of button names in display order. Positions apply to the Bottom bar layout; the other layouts place buttons themselves.
Share targets are whatsapp, twitter, facebook, pinterest, email, linkedin, reddit, digg and copyLink, each with enabled. shareUrl, shareTitle and shareImage set what is shared.
On narrow embeds the toolbar moves buttons that don't fit into the More menu (below compactBreakpoint, 768 px).
Table of contents
A PDF with an outline gets its table of contents automatically. To set your own:
tableOfContent: [
{ title: "Introduction", page: 3 },
{ title: "Products", page: 6, items: [
{ title: "Sofas", page: 6 },
{ title: "Tables", page: 10 }
]}
]A title on a page in pages also adds it. Thumbnails, contents and search open as panels next to the book:

thumbnailsOnStart)
contentOnStart)
searchOnStart: "word")Phones and tablets
On phones the flipbook shows one page at a time, side arrows are off and the toolbar is compact. Anything inside mobile overrides the options on phones and tablets:
mobile: {
viewMode: "swipe",
pdfUrl: "/files/brochure-small.pdf",
btnPrint: { enabled: false }
}
Covers, right to left, deep links
- Covers:
cover: falsestarts the book with a spread instead of a single front cover;backCoverdoes the same for the end.hardCover: truegives the book stiff covers (withhardCoverColor). - Start page:
startPage.pageNumberOffsetshifts the numbers shown when the printed numbering starts later. - Right to left:
rightToLeft: truefor Arabic, Hebrew and manga. - Deep linking:
deeplinkingEnabled: trueadds the page to the URL (#page2), so readers can share a page. With several books on one page, give each adeeplinkingPrefix, for example"book1_": the link#book1_5opens that book on page 5, and opens its lightbox if it is a lightbox book. - Autoplay:
autoplayOnStart,autoplayInterval(ms),autoplayLoop. - Sound:
soundturns the page-turn sound on or off;backgroundMusictakes an mp3 URL. - Logo:
logoImg,logoUrl,logoCSS. - Part of a PDF:
pageRangeStartandpageRangeEnd. - Zoom:
zoomMin(initial zoom),zoomStep,zoomReset(reset zoom after a page turn),doubleClickZoomDisabled.
Page items
Add items to a page to put links, media and hotspots on it. Positions are pixels on a page 1000 px tall; the width follows the page's proportions. For a PDF flipbook, list only the pages that have items:
new FlipBook(el, {
pdfUrl: "/files/catalog.pdf",
pages: [
{}, // page 1
{ items: [ // page 2
{ type: "link", x: 80, y: 600, width: 300, height: 60, url: "https://example.com/shop" },
{ type: "link", x: 80, y: 700, width: 300, height: 60, page: 8 },
{ type: "youtube", x: 80, y: 120, width: 560, height: 315, url: "https://youtu.be/VIDEO_ID" }
]}
]
});| Type | What it shows | Keys besides x, y, width, height |
|---|---|---|
link | A clickable area: opens a URL, or turns to a page. | url or page, target, tooltip |
hotspot | A pulsing marker with a tooltip or product card (next section). | tooltip, url or page, hotspotStyle, dotColor, dotSize, pulse |
spotlight | An area that opens an image, video or YouTube URL in a lightbox. | url, title, description |
image | An image on the page. | url |
video | An mp4 video on the page. | url, autoplay, controls, loop, muted |
audio | An mp3 player. | url, autoplay, controls, loop |
youtube | A YouTube video. | url, autoplay, controls, loop, muted |
iframe | Any embed: a URL or full iframe code (Vimeo, maps, forms). | url |
text | Text on the page. | textContent, fontFamily, fontSize, fontColor, bold, italic, underline |
Video and audio pause when the page turns away and, with autoplay, play again when it comes back.
Hotspots and product cards
A hotspot shows a marker. Its tooltip is either text or a card with a picture, price and buttons:
{
type: "hotspot", x: 300, y: 420, width: 40, height: 40,
hotspotStyle: "dot",
tooltip: {
title: "Arne Sofa, three-seat",
price: "€1,290",
description: "Solid oak frame, wool upholstery.",
image: "/img/arne-sofa.jpg",
url: "https://example.com/products/arne-sofa",
cartUrl: "https://example.com/cart/add?id=123"
}
}
urladds a View product button;cartUrladds Add to cart (the chosen quantity is added to the URL).showQuantity: trueadds a quantity stepper.images(an array) makes the picture a gallery.hotspotStyle:dot(default),ring,plus,icon,tag,price(shows the price as a tag) orbutton.pointsgives the hotspot any shape;pulse: falsestops the animation.- Global options:
hotspotDotColor,hotspotDotSize,hotspotTooltipWidth, andhotspotButtons: { radius, background, color, uppercase }for the card buttons.
Page HTML
For full control, give a page htmlContent: HTML drawn on a layer over the page (1000 px tall). These classes give elements flipbook behaviour:
{
htmlContent:
'<a class="flipbook-page-item" href="https://example.com" target="_blank" ' +
'style="position:absolute;top:100px;left:100px;width:300px;height:60px"></a>' +
'<a class="flipbook-page-item internalLink" data-page="5" href="#" ' +
'style="position:absolute;top:200px;left:100px;width:300px;height:60px"></a>' +
'<a class="flipbook-page-item spotlight" data-url="/video/intro.mp4" href="#" ' +
'style="position:absolute;top:300px;left:100px;width:300px;height:200px"></a>'
}PDF links
Links inside the PDF work by default. pdfAutoLinks: true turns plain web addresses in the PDF text into links too. linkTarget is "_blank" (new tab, default) or "_self"; linkColor, linkColorHover and linkOpacity style the link areas.
Options
The most used options. Pass any of them to new FlipBook(element, options), or change style options later with setOptions.
Content
| Option | Default | What it does |
|---|---|---|
pdfUrl | null | PDF to show. |
pages | [] | Page images, or per-page items for a PDF. |
name | "" | Name of the book, used in analytics, events and sharing. |
tableOfContent | [] | Custom contents (see Table of contents). |
startPage | 0 | Page to open on. |
pageRangeStart, pageRangeEnd | null | Show only part of the PDF. |
pageNumberOffset | 0 | Shift the page numbers shown. |
pdfTextLayer | true | Text selection and search in PDFs. |
pdfAutoLinks | false | Turn web addresses in PDF text into links. |
disableRange | false | Download the whole PDF instead of the parts being read. |
cMapUrl | Folder of the PDF character maps (assets/cmaps/), for PDFs with Asian fonts. | |
assets.flipMp3 | "assets/mp3/turnPage.mp3" | Page-turn sound. |
Display
| Option | Default | What it does |
|---|---|---|
viewMode | "webgl" | webgl, 3d, 2d, swipe, scroll, simple. |
layout | 1 | Toolbar layout 1 to 10. |
skin | "" (light) | light, dark, gradient. |
glass | false | Frosted toolbar and panels. |
iconSet | "fontawesome" | fontawesome (solid) or lucide (outline). |
accentColor | null | Accent for highlights and the progress bar. |
backgroundColor | "rgb(81, 85, 88)" | Background behind the book. |
backgroundImage, backgroundPattern | "" | Background image (cover) or repeating pattern. |
backgroundTransparent | false | No background. |
singlePageMode | false | One page at a time. |
cover, backCover | true | Single front and back cover. |
hardCover | false | Stiff covers; hardCoverColor sets their edge color. |
rightToLeft | false | Right-to-left reading. |
pageFlipDuration | 1 | Turn speed in seconds. |
sound | true | Page-turn sound. |
backgroundMusic | false | URL of an mp3 that plays while reading. |
turnHint | true | One-time hint that pages can be turned. |
sideNavigationButtons | true | Arrows at the sides of the book. |
responsiveContainer | true | Size the container to the book. |
minimalView | false | In very small embeds (below minimalViewBreakpoint), show only an expand button. |
logoImg, logoUrl, logoCSS | "" | Logo over the book. |
preloaderText | "" | Text under the loading spinner. |
Toolbar
| Option | Default | What it does |
|---|---|---|
btnOrder | all buttons | Order of the buttons. |
btn… | Each button's settings (see Toolbar buttons). | |
progressBar | { enabled: false } | Progress bar along the toolbar. |
menuAutoHide | false | Hide the toolbar on touch devices after menuAutoHideDelay ms. |
hideMenu | false | No toolbar. |
compactBreakpoint | 768 | Below this width, extra buttons move into More. |
skinColor, skinBackground | "#222", "#FFF" | Toolbar icon and background colors. |
btnSize, btnRadius, btnColor, btnBackground | 18, 2, "", "none" | Toolbar buttons. |
floatingBtnColor, floatingBtnBackground | "#FFF", "rgba(0,0,0,0.6)" | Buttons drawn over the book. |
arrowColor, arrowBackground, arrowSize | "#FFF", transparent, 40 | Side arrows. |
sideMenuPosition | "left" | Side of the thumbnails and contents panels. |
thumbnailsOnStart, contentOnStart | false | Open the thumbnails or contents panel at start. |
searchOnStart | false | A word to search for at start. |
shareUrl, shareTitle, shareImage | null | What the Share menu shares. |
Zoom and navigation
| Option | Default | What it does |
|---|---|---|
zoomMin | 0.95 | Book size when not zoomed. |
zoomStep | 1.5 | Zoom per click. |
zoomReset | false | Zoom out after a page turn. |
doubleClickZoomDisabled | false | Turn off double-click zoom. |
wheelDisabledNotFullscreen | false | Mouse wheel zooms only in fullscreen. |
pageDragDisabled | false | Turn pages only with buttons and clicks. |
arrowsAlwaysEnabledForNavigation | true | Keyboard arrows turn pages. |
arrowsDisabledNotFullscreen | false | Keyboard arrows only in fullscreen. |
deeplinkingEnabled, deeplinkingPrefix | false, "" | Page number in the URL. |
autoplayOnStart, autoplayInterval, autoplayLoop | false, 3000, true | Turn pages automatically. |
rightClickEnabled | true | Browser right-click menu. |
Lightbox
| Option | Default | What it does |
|---|---|---|
lightBox | false | Open from the element in a lightbox. |
lightBoxOpened | false | Open when the page loads. |
lightBoxFullscreen | false | Open in fullscreen. |
lightboxStartPage | null | Page to open on. |
lightboxBackground | null | Overlay background (any CSS background). |
lightboxMarginV, lightboxMarginH | "0" | Space around the lightbox. |
lightboxPreload | false | Load before the first click. |
lightboxCloseOnBack | true | Back button closes it. |
Real 3D view
| Option | Default | What it does |
|---|---|---|
lights, lightIntensity | true, 0.6 | Lighting on the pages. |
shadows, shadowOpacity | true, 0.3 | Shadows of turning pages. |
pageHardness, coverHardness | 2 | How stiff pages and covers are. |
pan, tilt | 0 | Camera angle. |
rotateCameraOnMouseDrag | true | Drag outside the pages to rotate the camera. |
pagesInMemory | 40 | Pages kept loaded; lower it for very long books. |
Other
| Option | Default | What it does |
|---|---|---|
googleAnalyticsTrackingCode | null | GA4 measurement ID (G-…). |
linkTarget | "_blank" | Where page links open. |
strings | English | Interface text (see Translating). |
mobile | Options that apply on phones and tablets. | |
customCSS | "" | CSS added for this book. |
API and events
new FlipBook() returns the flipbook. FLIPBOOK.getBook(elementOrId) returns the flipbook created in an element, for example from another script.
const book = new FlipBook(document.getElementById("container"), { pdfUrl: "/files/brochure.pdf" });
book.nextPage();
book.prevPage();
book.goToPage(12);
book.firstPage();
book.lastPage();
book.zoomIn();
book.zoomOut();
book.toggleExpand(); // fullscreen on or off
book.toggleAutoplay(true);
book.toggleThumbs(true);
book.toggleToc(true);
// change the look without reloading
book.setOptions({ layout: 4, skin: "dark", iconSet: "lucide" });setOptions changes the toolbar layout, skin, colors, background and icons of a flipbook that is already on the page.
Events
// on the flipbook
book.on("pagechange", function () { console.log("page changed"); });
// on window, for every flipbook on the page
window.addEventListener("r3d-pagechange", e => console.log(e.detail.page, e.detail.name));
window.addEventListener("r3d-lightboxopen", () => console.log("opened"));
window.addEventListener("r3d-lightboxclose", () => console.log("closed"));
// every reader action
window.addEventListener("r3d-event", e => console.log(e.detail));r3d-event reports reader actions with or without Google Analytics: event (the action), the page number, the URL or label where there is one, and the book's name and id. Use it to send reading data to your own analytics.
Analytics
Set googleAnalyticsTrackingCode: "G-XXXXXXX". The flipbook loads Google Analytics if the page doesn't already have it and sends events such as flipbook_page_view, flipbook_page_link_click, flipbook_hotspot_click, flipbook_pdf_download, flipbook_share, flipbook_zoom, flipbook_print, flipbook_page_video_play and the flipbook_audio_* events. Each carries the book name, so you can compare books.
Translating
Button tooltips are the title of each button. Panel and menu text is in strings:
new FlipBook(el, {
pdfUrl: "/files/katalog.pdf",
btnThumbs: { title: "Seiten" },
btnSearch: { title: "Suchen" },
strings: {
search: "Suchen",
findInDocument: "Im Dokument suchen",
noMatches: "Keine Treffer",
tableOfContent: "Inhalt",
print: "Drucken",
download: "Herunterladen",
copyLink: "Link kopieren",
addToCart: "In den Warenkorb"
}
});Other keys include printLeftPage, printRightPage, printCurrentPage, printAllPages, the matching download… and bookmark… keys, bookmarks, noBookmarks, thumbnails, share, page, matchesFound and viewProduct.
Faster loading
- Keep HTTP range requests working on your server (most do), so the PDF downloads in parts as pages are read. Don't set
disableRange. - Save the PDF web-optimized (linearized), with about 150 dpi photos and JPEG compression.
- For long or heavy PDFs, convert the PDF to images and use
pageswithjsonfor text and links. Pages then load as images and the PDF reader is not loaded at all. - Image pages: JPG or WebP of about 200 to 300 KB, no more than 2000 to 3000 px tall, with a
thumbfor each page. - Use the lightbox when the flipbook isn't the main content, so nothing loads until a reader opens it.
- Give phones a smaller PDF with
mobile: { pdfUrl: "…" }, and lowerpagesInMemoryfor very long books.
Troubleshooting
The examples don't work when I open them from disk
Browsers block PDFs and scripts loaded from file://. Put the files on a web server or a local server (for example npx serve or python3 -m http.server) and open them from http://localhost.
The flipbook doesn't show
Open the browser console (F12) and look for errors. The usual causes: the path to the PDF or images is wrong, the files are on another domain (next item), the container has no height, or the js folder is incomplete.
The PDF or images load from another domain (CORS)
The server with the files must allow your site to read them. On Apache (.htaccess):
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "Range"
Header set Access-Control-Expose-Headers "Accept-Ranges, Content-Encoding, Content-Length, Content-Range"
</IfModule>On Nginx, add the same three headers with add_header. On Amazon S3, add a CORS rule that allows GET and HEAD, the Range header and exposes Accept-Ranges, Content-Length and Content-Range. Replace * with your site address to allow only your site.
The page-turn sound doesn't play
Check that assets.flipMp3 points at the mp3 in your assets/mp3/ folder.
The flipbook asks for a license on my site
Activate the domain the page runs on (see Activate your license). A license moved to a new domain must be deactivated on the old one first.
Support
Contact us
Ask on real3dflipbook.com. Include the page URL and what you see in the browser console.
Examples
See view modes and layouts on the examples page.
Changelog
changelog.txt in the zip lists what changed in each version.