Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Comic Reader</title>
- <style>
- body {
- margin: 0;
- padding: 0;
- font-family: Arial, sans-serif;
- background-color: #222;
- color: white;
- overflow-x: hidden;
- }
- #header {
- background-color: #111;
- padding: 15px;
- text-align: center;
- box-shadow: 0 2px 10px rgba(0,0,0,0.5);
- }
- #comic-container {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 20px 0;
- transition: transform 0.3s ease;
- }
- .comic-page {
- max-width: 100%;
- margin-bottom: 20px;
- box-shadow: 0 4px 8px rgba(0,0,0,0.3);
- }
- #upload-container {
- text-align: center;
- padding: 20px;
- background-color: #333;
- margin-bottom: 20px;
- }
- #file-input {
- display: none;
- }
- .upload-btn {
- background-color: #4CAF50;
- color: white;
- padding: 10px 20px;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- font-size: 16px;
- }
- .upload-btn:hover {
- background-color: #45a049;
- }
- #zoom-controls {
- position: fixed;
- bottom: 20px;
- right: 20px;
- display: flex;
- flex-direction: column;
- gap: 10px;
- }
- .zoom-btn {
- width: 40px;
- height: 40px;
- border-radius: 50%;
- background-color: #444;
- color: white;
- border: none;
- font-size: 20px;
- cursor: pointer;
- display: flex;
- align-items: center;
- justify-content: center;
- box-shadow: 0 2px 5px rgba(0,0,0,0.3);
- }
- .zoom-btn:hover {
- background-color: #555;
- }
- </style>
- </head>
- <body>
- <div id="header">
- <h1>Comic Reader</h1>
- </div>
- <div id="upload-container">
- <input type="file" id="file-input" accept="image/*" multiple>
- <button class="upload-btn" onclick="document.getElementById('file-input').click()">Upload Comic Pages</button>
- </div>
- <div id="comic-container"></div>
- <div id="zoom-controls">
- <button class="zoom-btn" id="zoom-in">+</button>
- <button class="zoom-btn" id="zoom-out">-</button>
- <button class="zoom-btn" id="zoom-reset">↻</button>
- </div>
- <script>
- const fileInput = document.getElementById('file-input');
- const comicContainer = document.getElementById('comic-container');
- const zoomInBtn = document.getElementById('zoom-in');
- const zoomOutBtn = document.getElementById('zoom-out');
- const zoomResetBtn = document.getElementById('zoom-reset');
- let currentScale = 1;
- fileInput.addEventListener('change', function(e) {
- const files = e.target.files;
- // Clear previous content
- comicContainer.innerHTML = '';
- if (files.length === 0) return;
- for (let i = 0; i < files.length; i++) {
- const file = files[i];
- if (!file.type.match('image.*')) continue;
- const reader = new FileReader();
- reader.onload = function(e) {
- const img = document.createElement('img');
- img.src = e.target.result;
- img.className = 'comic-page';
- comicContainer.appendChild(img);
- }
- reader.readAsDataURL(file);
- }
- });
- zoomInBtn.addEventListener('click', function() {
- currentScale *= 1.2;
- comicContainer.style.transform = `scale(${currentScale})`;
- });
- zoomOutBtn.addEventListener('click', function() {
- currentScale /= 1.2;
- comicContainer.style.transform = `scale(${currentScale})`;
- });
- zoomResetBtn.addEventListener('click', function() {
- currentScale = 1;
- comicContainer.style.transform = `scale(${currentScale})`;
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement