当前位置: 首页 > news >正文

【html组件】简易漫画阅读器

【html组件】简易漫画阅读器

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>迷路的斑鸠</title><style>* {margin: 0;padding: 0;box-sizing: border-box;}body {font-family: 'Microsoft YaHei', Arial, sans-serif;background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);min-height: 100vh;display: flex;flex-direction: column;align-items: center;padding: 20px;}h1 {color: white;margin-bottom: 20px;text-align: center;text-shadow: 0 2px 4px rgba(0,0,0,0.3);font-size: 2.5rem;}.comic-container {width: 90%;max-width: 1200px;height: 70vh;background: rgba(255, 255, 255, 0.95);border-radius: 15px;box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);overflow: hidden;display: flex;justify-content: center;align-items: center;margin-bottom: 30px;padding: 20px;}#comic-img {max-width: 100%;max-height: 100%;object-fit: contain;border-radius: 8px;box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);}.control-panel {display: flex;justify-content: center;align-items: center;gap: 20px;background: rgba(255, 255, 255, 0.9);padding: 20px 40px;border-radius: 50px;box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);}button {background: linear-gradient(45deg, #667eea, #764ba2);color: white;border: none;padding: 12px 25px;font-size: 16px;border-radius: 25px;cursor: pointer;transition: all 0.3s ease;box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);}button:hover {transform: translateY(-3px);box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);background: linear-gradient(45deg, #764ba2, #667eea);}button:active {transform: translateY(1px);}#page-select {padding: 10px 20px;font-size: 16px;border: 2px solid #667eea;border-radius: 25px;background: white;color: #333;outline: none;cursor: pointer;text-align: center;box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);}#page-select:focus {border-color: #764ba2;box-shadow: 0 0 0 3px rgba(118, 75, 162, 0.3);}/* 响应式设计 */@media (max-width: 768px) {h1 {font-size: 2rem;}.comic-container {height: 60vh;padding: 10px;}.control-panel {flex-direction: column;border-radius: 20px;padding: 20px;}button {padding: 10px 20px;font-size: 14px;}#page-select {padding: 8px 15px;font-size: 14px;}}@media (max-width: 480px) {h1 {font-size: 1.5rem;}.comic-container {height: 50vh;width: 95%;}.control-panel {gap: 10px;padding: 15px;}}/* 针对720*1280px屏幕的特殊处理 */@media (min-width: 720px) and (max-width: 768px){.control-panel {flex-direction: row !important;}body {padding: 15px;}h1 {font-size: 2rem;margin-bottom: 15px;}.comic-container {height: 65vh;}}</style>
</head>
<body><h1>迷路的斑鸠</h1><div class="comic-container"><img id="comic-img" src="" alt="漫画页面"></div><div class="control-panel"><button onclick="page_up()">上一页</button><select id="page-select"></select><button onclick="page_down()">下一页</button></div><script>// url数组
        const comic_images = ["1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg","7.jpg","8.jpg","9.jpg","10.jpg","11.jpg","12.jpg","13.jpg","14.jpg","15.jpg","16.jpg","17.jpg","18.jpg"];var current_page_index = 0;const total_pages = comic_images.length;const comicImag = document.getElementById("comic-img");const pageSelect = document.getElementById("page-select");pageSelect.addEventListener("change", function() {current_page_index = pageSelect.value;update_comic_page();});function page_up(){if(current_page_index > 0){current_page_index--;update_comic_page();}}function page_down(){if(current_page_index < total_pages - 1){current_page_index++;update_comic_page();}}function update_comic_page(){comicImag.src = comic_images[current_page_index];pageSelect.value = current_page_index;}function init_page_select(){pageSelect.innerHTML = "";for(let i = 0; i < total_pages; i++){const option = document.createElement("option");option.value = i;option.text = i + 1;pageSelect.appendChild(option);}}if(total_pages > 0){init_page_select();update_comic_page();}</script>
</body>
</html>

 

http://www.hskmm.com/?act=detail&tid=14476

相关文章:

  • ubuntu安装mysql2
  • 高并发系统核心指标
  • 工程化知识管理新范式:DevOps驱动下的智能文档体系建设实践
  • 从零开始学Flink:数据转换的艺术
  • java创建线程池去实现某个任务(多线程)
  • 20250827_黔西南网信杯_丢失的数据
  • 敏捷已死?2025年项目管理软件支持的混合管理模式正成为新主流!
  • 螺旋矩阵-leetcode
  • 【第十一章】Python 调用 MySQL 全面指南:从基础到实践​ - 实践
  • 开源中国社区:AI驱动下的开发者生态革命
  • 日志清理脚本模板 - 一叶舟
  • 11.备库出现gap处理方法
  • [原创]《C#高级GDI+实战:从零开发一个流程图》第10章:鼠标拖动完成连线、拖动时实时显示半透明虚线连线效果、自定义连接点样式
  • 修改Abp中Auto API Controllers中 默认生成的 Put、Delete请求
  • 电阻-温度数据拟合工具(最小二乘法)
  • delphi clientdataset 中文过滤问题
  • 基于 systemd 的 Go 应用自动化部署完整指南
  • 马来西亚股票数据API对接文档
  • [OpenGL]相机环境
  • 指令流水线的影响因素
  • Gitee本土化创新实践:中国企业研发效能提升的新引擎
  • 画面拼接后推流/64路画面同时拼接到一路流/指定程序窗口采集推流/另一种解决方案
  • Markdown的基本语法
  • 工业级CAD数据优化工具:PiXYZ Studio 2025 图文安装指南
  • BIM建模利器 Tekla Structures 2025 全流程安装指南
  • containerd离线安装
  • (转)使用 Embarcadero Delphi FMX 应用程序实现多点触控
  • 百度云服务ubtuntu安装docker
  • ubuntu安装mysql8并切换数据存储目录
  • WCF-双工通讯