A modern, component-based digital magazine viewer with smooth page-turning animations, fullscreen support, and cross-platform compatibility.
- 🏗️ Modern Architecture - Component-based ES6 classes with event-driven communication
- 📱 Cross-Platform - Optimized for iOS, Android, Windows Phone, and Desktop
- 🔄 Smooth Animations - Page-turning effects with turn.js integration
- 📊 Smart Preloading - Progressive image loading with real-time progress
- 🖥️ Fullscreen Mode - Cross-browser fullscreen support
- ⌨️ Multiple Navigation - Touch, mouse, and keyboard controls
- 🎨 Loading Experience - Animated loading indicators
- 📱 Mobile Optimized - iOS bounce prevention and touch handling
# Clone and serve
git clone [repository-url]
cd magazine-app
# Serve with any web server
python -m http.server 8000
# or
npx http-serverOpen http://localhost:8000 in your browser.
MagazineApp (Main Controller)
├── DeviceManager (Platform Detection)
├── ImagePreloader (Asset Management)
├── LoadingIndicator (Progress UI)
├── MagazineViewer (Core Functionality)
├── NavigationCtrls (Navigation UI)
└── FullscreenManager (Fullscreen API)
ImagePreloader → progress → LoadingIndicator
ImagePreloader → complete → MagazineApp
NavigationCtrls → goToPage → MagazineViewer
MagazineViewer → pageTurned → NavigationCtrls
js/
├── components/ # Modern component architecture
│ ├── MagazineApp.js # Main application controller
│ ├── MagazineViewer.js # Core magazine viewing & turn.js integration
│ ├── NavigationCtrls.js # Navigation controls & user input
│ ├── FullscreenManager.js # Cross-browser fullscreen API
│ ├── DeviceManager.js # Device detection & optimization
│ ├── ImagePreloader.js # Progressive image loading
│ └── LoadingIndicator.js # Loading UI & progress display
├── utils/
│ └── EventEmitter.js # Custom event system
├── jquery.min.js # jQuery (turn.js dependency)
└── modernizr.2.5.3.min.js # Feature detection
css/
├── basic.css # Core styles
└── fullscreen.css # Fullscreen-specific styles
image/ # Magazine page images
├── 001.jpg → 026.jpg # Sequential page images
└── 000.png # Logo/favicon
- jQuery - Required for turn.js functionality
- turn.js - Page turning animations (not sure if this still works with this app)
- Modernizr - Feature detection
- Modern browsers with ES6 class support
- Mobile browsers (iOS Safari 10+, Chrome Mobile 60+)
- Desktop browsers (Chrome 60+, Firefox 55+, Safari 10+, Edge 79+)
Main application orchestrator.
const app = new MagazineApp();Properties:
imageUrls: string[]- Magazine page image URLs (26 pages)components: object- All component instances
Events:
loadingComplete- All images loaded, viewer readyready- Application fully initialized
Platform detection and device-specific optimizations.
const deviceManager = new DeviceManager();Methods:
detectDevice(): string- Returns'android'|'ios'|'windows'|'desktop'getDeviceType(): string- Get current device typedisableIOSBounce(): void- Disable iOS elastic scrolling
Progressive image loading with progress tracking.
const preloader = new ImagePreloader(imageUrls);
preloader.load();Events:
// Progress updates
preloader.on('progress', (data) => {
// data: { percentage: 0-100, loaded: number, total: number }
});
// Loading complete
preloader.on('complete', (data) => {
// data: { loadingTime: ms, totalImages: number }
});Core magazine functionality with turn.js integration.
const viewer = new MagazineViewer(imageUrls);Methods:
setupFlipbook(): void- Initialize turn.js flipbookgoToPage(page: number): void- Navigate to specific pagenextPage(): void- Go to next pagepreviousPage(): void- Go to previous page
Events:
pageTurning- Page turn animation startingpageTurned- Page turn completed with{ page, view }ready- Viewer initialized and ready
User interface for magazine navigation.
const controls = new NavigationControls(totalPages);Methods:
updateCurrentPage(page: number): void- Update page display
Events:
goToFirst- Navigate to first pagegoToLast- Navigate to last pagepreviousPage- Go to previous pagenextPage- Go to next pagegoToPage- Navigate to specific page number
Cross-browser fullscreen functionality.
const fullscreen = new FullscreenManager();Methods:
toggle(): void- Toggle fullscreen modeenter(): void- Enter fullscreenexit(): void- Exit fullscreenisInFullscreen(): boolean- Check fullscreen status
Loading progress display and animations.
const indicator = new LoadingIndicator();Methods:
show(): void- Show loading overlayhide(): void- Hide loading overlayupdateProgress(percentage: number): void- Update progress (0-100)
-
Prepare Images
image/ ├── 001.jpg # First page ├── 002.jpg # Second page └── ... # Up to 026.jpgIt can hold as many images as you'll like to use.
-
Add turn.js Dependency
<script src="/js/turn.js"></script>
-
Customize Image URLs
this.imageUrls = [ "/image/001.jpg", "/image/002.jpg", // Add your images here ];
Turn.js Settings (in MagazineViewer.js):
$('.flipbook').turn({
width: 800,
height: 600,
autoCenter: true,
duration: 1000, // Animation speed
acceleration: true, // Hardware acceleration
gradients: true, // Page shadows
elevation: 50 // 3D effect depth
});Device-Specific Behavior:
// Customize in DeviceManager.js
if (this.deviceType === 'ios') {
this.disableIOSBounce(); // Prevent elastic scrolling
}document.addEventListener('DOMContentLoaded', () => {
const app = new MagazineApp();
document.getElementById('magazine-app').appendChild(app.element);
});const app = new MagazineApp();
app.components.viewer.on('pageTurned', (data) => {
console.log(`Now on page ${data.page}`);
// Custom page change logic
});
app.components.preloader.on('progress', (data) => {
console.log(`Loading: ${data.percentage}%`);
// Custom progress handling
});// Navigate to specific page
app.components.viewer.goToPage(5);
// Go to next page
app.components.viewer.nextPage();
// Toggle fullscreen
app.components.fullscreenManager.toggle();-
Create Component
class NewComponent extends EventEmitter { constructor(options) { super(); this.options = options; this.init(); } init() { // Component logic } }
-
Register in MagazineApp
this.components = { // existing components... newComponent: new NewComponent(options) };
-
Set up Communication
this.components.newComponent.on('event', (data) => { // Handle component events });
All components extend EventEmitter for consistent communication:
// Emit events
this.emit('eventName', { data: 'value' });
// Listen for events
component.on('eventName', (data) => {
// Handle event
});
// Remove listeners
component.off('eventName', callback);- Use progressive JPEG format
- Optimize file sizes (recommended: 200-500KB per page)
- Consider WebP format for modern browsers
- Images are preloaded but not cached indefinitely
- Event listeners are properly managed
- Mobile-specific optimizations included
- Progressive loading with visual feedback
- Error handling for failed image loads
- Graceful degradation on slow connections
- Chrome 60+ (Desktop/Mobile)
- Firefox 55+ (Desktop/Mobile)
- Safari 10+ (Desktop/Mobile)
- Edge 79+ (Chromium-based)
- Internet Explorer 11 (limited ES6 support)
- Older mobile browsers (may need polyfills)
Images not loading:
- Verify image paths in
MagazineApp.js - Check web server static file serving
- Ensure proper CORS headers if serving from different domain
Turn.js not working:
- Add
<script src="/js/turn.js"></script>to HTML - Verify jQuery loads before turn.js
- Check browser console for JavaScript errors
Mobile touch issues:
- Test on actual devices, not just browser dev tools
- Verify touch event handling in NavigationControls
- Check iOS bounce prevention is working
Performance issues:
- Monitor memory usage on mobile devices
- Optimize image file sizes
- Consider reducing animation duration
Enable console logging:
// Add to MagazineApp constructor
this.debug = true;
// Components will log events when debug is enabledNote: This application uses a modern, component-based architecture with no legacy code dependencies. All functionality is implemented through ES6 classes with event-driven communication.