Gathering detailed insights and metrics for page-flip
Gathering detailed insights and metrics for page-flip
Gathering detailed insights and metrics for page-flip
Gathering detailed insights and metrics for page-flip
Simple library for creating realistic page turning effects
npm install page-flip
Typescript
Module System
Node Version
NPM Version
94.5
Supply Chain
100
Quality
76
Maintenance
100
Vulnerability
100
License
TypeScript (98.18%)
JavaScript (1.14%)
CSS (0.68%)
Total Downloads
1,796,854
Last Day
707
Last Week
12,080
Last Month
50,798
Last Year
632,910
MIT License
613 Stars
97 Commits
119 Forks
12 Watchers
7 Branches
2 Contributors
Updated on Jul 05, 2025
Minified
Minified + Gzipped
Latest Version
2.0.7
Package Id
page-flip@2.0.7
Unpacked Size
8.96 MB
Size
8.76 MB
File Count
32
NPM Version
6.14.8
Node Version
12.20.0
Cumulative downloads
Total Downloads
Last Day
26.5%
707
Compared to previous day
Last Week
-6.6%
12,080
Compared to previous week
Last Month
0.8%
50,798
Compared to previous month
Last Year
6.4%
632,910
Compared to previous year
Powerful, simple, and flexible JS Library for creating realistic and beautiful page turning effect.
Demo and docs: https://nodlik.github.io/StPageFlip/
For React.JS you can use: https://nodlik.github.io/react-pageflip/
Docs (generated by TypeDoc): https://nodlik.github.io/StPageFlip/docs/index.html
You can install the latest version using npm:
npm install page-flip
Or download bundle from Github
If you've installed the package from npm, you should import PageFlip from page-flip package, or just use <script/>
tag:
1<script src="{path/to/scripts}/page-flip.browser.js"></script>
To create a new PageFlip object:
1import { PageFlip } from 'page-flip';
2
3const pageFlip = new PageFlip(htmlParentElement, settings);
4
5// or if you're using a script tag and page-flip.browser.js:
6const pageFlip = new St.PageFlip(htmlParentElement, settings);
htmlParentElement - HTMLElement
- root element, where the book will be created
settings: object
- configuration object.
To draw on a canvas, use loadFromImages
:
1pageFlip.loadFromImages(['path/to/image1.jpg', 'path/to/image2.jpg' ... ]);
To load page from html elements - use loadFromHtml
:
1pageFlip.loadFromHtml(items);
For example:
1<div id="book"> 2 <div class="my-page" data-density="hard"> 3 Page Cover 4 </div> 5 <div class="my-page"> 6 Page one 7 </div> 8 <div class="my-page"> 9 Page two 10 </div> 11 <div class="my-page"> 12 Page three 13 </div> 14 <div class="my-page"> 15 Page four 16 </div> 17 <div class="my-page" data-density="hard"> 18 Last page 19 </div> 20</div>
1const pageFlip = new PageFlip(document.getElementById('book'), {
2 width: 400, // required parameter - base page width
3 height: 600, // required parameter - base page height
4});
5
6pageFlip.loadFromHTML(document.querySelectorAll('.my-page'));
Use data-density="hard"
attribute to specify page type (soft | hard
) and define flipping animation.
To set configuration define these parameters when creating an object:
width: number
- requiredheight: number
- requiredsize: ("fixed", "stretch")
- default: "fixed"
Whether the book will be stretched under the parent element or notminWidth, maxWidth, minHeight, maxHeight: number
You must set threshold values with size: "stretch"
drawShadow: bool
- default: true
Draw shadows or not when page flippingflippingTime: number
(milliseconds) - default: 1000
Flipping animation timeusePortrait: bool
- default: true
Enable switching to portrait mode. !This mode uses cloning of html elements (pages)startZIndex: number
- default: 0
Initial value to z-indexstartPage: number
- default: 0
Page number from which to start viewingautoSize: bool
- default: true
If this value is true, the parent element will be equal to the size of the bookmaxShadowOpacity: number [0..1]
- default: 1
Shadow intensity (1: max intensity, 0: hidden shadows)showCover: boolean
- default: false
If this value is true, the first and the last pages will be marked as hard and will be shown in single page modemobileScrollSupport: boolean
- default: true
disable content scrolling when touching a book on mobile devicesswipeDistance: number
- default: 30
(px) minimum distance to detect swipe (new on 1.1.0)clickEventForward: boolean
- default: true
forwarding click events to the page children html elements (only for a
and button
tags) (new on 1.1.0)useMouseEvents: boolean
- default: true
using mouse and touch events to page flipping (new on 1.2.0)disableFlipByClick: boolean
- default: false
if this value is true, flipping by clicking on the whole book will be locked. Clicking will only work in corners (new on 2.0.3)To listen events use the method on
:
1pageFlip.on('flip', (e) => { 2 // callback code 3 alert(e.data); // current page number 4});
Available events:
flip: number
- triggered by page turningchangeOrientation: ("portrait", "landscape")
- triggered when page orientation changeschangeState: ("user_fold", "fold_corner", "flipping", "read")
- triggered when the state of the book changesinit: ({page: number, mode: 'portrait', 'landscape'})
- triggered when the book is init and the start page is loaded. Listen (on
) this event before using the "loadFrom..." methodsupdate: ({page: number, mode: 'portrait', 'landscape'})
- triggered when the book pages are updated (using the "updateFrom..." methods)Event object has two fields: data: number | string
and object: PageFlip
getPageCount: number
- Get number of all pagesgetOrientation: 'portrait', 'landscape'
- Get the current orientation: portrait or landscapegetBoundsRect: PageRect
- Get current book sizes and positiongetCurrentPageIndex: number
- Get the current page number (starts at 0)turnToPage(pageNum: number)
- Turn to the specified page number (without animation)turnToNextPage()
- Turn to the next page (without animation)turnToPrevPage()
- Turn to the previous page (without animation)flipNext(corner: 'top' | 'bottom')
- Turn to the next page (with animation)flipPrev(corner: 'top' | 'bottom')
- Turn to the previous page (with animation)flip(pageNum: number, corner: 'top' | 'bottom')
- Turn to the specified page (with animation)loadFromImages(images: ['path-to-image1.jpg', ...])
- Load page from imagesloadFromHtml(items: NodeListOf | HTMLElement[])
- Load page from html elementsupdateFromHtml(items: NodeListOf | HTMLElement[])
- Update page from html elements (new on 0.4.0)updateFromImages(images: ['path-to-image1.jpg', ...])
- Update page from images (new on 0.4.0)destroy()
- Destructor. Remove a root HTML element and all event handlers (new on 0.4.0)Oleg,
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 1/27 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More