zhangmin 2 lat temu
rodzic
commit
5786b26d8b
2 zmienionych plików z 145 dodań i 19 usunięć
  1. 18 5
      bookdetail.html
  2. 127 14
      index.html

+ 18 - 5
bookdetail.html

@@ -92,8 +92,9 @@
 					<div class="fontItem">
 						<span class="fontItemTitle">字号</span>
 						<div class="fontItemCons">
-							<button class="btn_Big" id="btn_Big">大</button>
-							<button class="btn_Small" id="btn_Small">小</button>
+<!--							<button class="btn_Big" id="btn_Big">大</button>
+							<button class="btn_Small" id="btn_Small">小</button>-->
+							<input style="width: 80%; margin: 0 auto;" type="range" id="slider" name="slider" min=16 max=24 step="1">
 						</div>
 					</div>
 					<div class="fontItem">
@@ -165,6 +166,7 @@
 				win: $(window),
 				icon_model: $("#icon_model"),
 				btn_Big: $("#btn_Big"),
+				slider: $("#slider"),
 				btn_Small: $("#btn_Small"),
 				icon_mulu: $("#icon_mulu"),
 				mulu_Box: $("#mulu_Box"),
@@ -238,8 +240,9 @@
 				InitFontSize = 18;
 			}
 			$("p").css('font-size', InitFontSize);
-			$("h4").css('font-size', InitFontSize);
-
+			$("h4").css('font-size', InitFontSize + 6);
+			$("h5").css('font-size', InitFontSize + 2);
+			Dom.slider.val(InitFontSize);
 
 			function ReaderBaseFrame(container) { //UI渲染层
 
@@ -326,7 +329,7 @@
 						File_id = parseInt(Util.StorageGetter("FileId"));
 						//选择是否从头阅读
 						if (Chapter_id !== 0) {
-							if (confirm('请问您要继续上次的阅读么?')) {
+							if (confirm('您要继续上次的阅读么?')) {
 							} else {
 								Chapter_id = 0;
 							}
@@ -579,6 +582,16 @@
 					// Dom.icon_mulu.css('border', '');
 				})
 				//点击 大、小事件
+				Dom.slider.change(function() {
+					let NowFontSize = $(this).val();
+					if (NowFontSize > 24 || NowFontSize < 16) {
+						return;
+					}
+					$("p").css('font-size', Number(NowFontSize));
+					$("h4").css('font-size', Number(NowFontSize)+ 6);
+					$("h5").css('font-size', Number(NowFontSize)+ 2);
+					Util.StorageSetter("font_size", Number(NowFontSize));
+				});
 				Dom.btn_Big.click(function() {
 					if (InitFontSize >= 24) {
 						return;

+ 127 - 14
index.html

@@ -2,25 +2,138 @@
 <html>
 <head>
     <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+    <meta name="viewport"
+          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
     <title></title>
     <script src="js/mui.min.js"></script>
     <link href="css/mui.min.css" rel="stylesheet"/>
     <script type="text/javascript" charset="utf-8">
-      	mui.init();
+        mui.init();
+        $(function () {
+            ScrollerTrack.Init();
+        });
+        var ScrollerTrack = {
+            BodyWidth: 500, MaxValue: 300, CurrentX: 0, CurrentValue: 0,
+            Count: 0, Init: function () {
+                var mWidth = ScrollerTrack.BodyWidth;
+                $(".contain").css("width", mWidth + "px");
+                var
+                    count = ScrollerTrack.MaxValue / 50;
+                ScrollerTrack.Count = count;
+                var itemWidth = mWidth / count;
+                for (var i = 0; i
+                < count
+                    ; i++) {
+                    var span = $("" + (i + 1) * 50 + "");
+                    $(span).css("width", itemWidth + "px").css("margin-left", i * itemWidth + "px");
+                    $(".value").append(span);
+                }
+                ScrollerTrack.Value();
+            }, Value: function () {
+                var currentValue;
+                var isMoving = false;
+                ScrollerTrack.CurrentX = $(".track").offset().left;
+                $(".track").mousedown(function () {
+                    var target = $(this).parent();
+                    isMoving = true;
+                    $("html,body").mousemove(function (event) {
+                        if (isMoving == false) return;
+                        var changeX = event.clientX -
+                            ScrollerTrack.CurrentX;
+                        currentValue = changeX - ScrollerTrack.CurrentX;
+                        if (changeX = ScrollerTrack.BodyWidth - 16) {
+                            $(target).find(".track").css("margin-left", ScrollerTrack.BodyWidth - 16 + "px");
+                            $(target).find(".valueC").css("width", ScrollerTrack.BodyWidth - 16 + "px");
+                            $(target).find(".show").css("margin-left",
+                                ScrollerTrack.BodyWidth - 31 + "px");
+                            $(target).find(".show").html(ScrollerTrack.MaxValue);
+                            ScrollerTrack.CurrentValue = ScrollerTrack.MaxValue;
+                        } else {
+                            $(target).find(".track").css("margin-left",
+                                changeX + "px");
+                            $(target).find(".valueC").css("width", changeX + "px");
+                            $(target).find(".show").css("margin-left",
+                                changeX - 15 + "px");
+                            var v = ScrollerTrack.MaxValue * ((changeX + 16) / ScrollerTrack.BodyWidth);
+                            $(target).find(".show").html(parseInt(v));
+                            ScrollerTrack.CurrentValue = parseInt(v);
+                        }
+                    });
+                });
+                $("html,body").mouseup(function () {
+                    isMoving = false;
+                });
+            }
+        }
     </script>
+    <style>
+        .main {
+            margin: 0 auto;
+            margin-top: 100px;
+            width: 500px;
+            font-family: 微软雅黑;
+            -webkit-user-select: none;
+        }
+
+        .contain {
+            width: 500px;
+            height: 40px;
+            background-color: #E8E8E8;
+        }
+
+        ;
+        .track {
+            width: 16px;
+            height: 46px;
+            position: absolute;
+            margin: -3px 0 0 0px;
+            background-color: #2dacd1;
+            cursor: pointer;
+        }
+
+        .valueC {
+            height: 40px;
+            position: absolute;
+            margin: 0;
+            background-color: #43BFE3;
+        }
+
+        .value
+        span {
+            position: absolute;
+            text-align: right;
+            height: 40px;
+            line-height: 40px;
+            color: #808080;
+            border-right: 1px solid #dddddd;
+        }
+
+        .show {
+            width: 45px;
+            height: 30px;
+            background-color: #333;
+            color: #fff;
+            text-align: center;
+            line-height: 30px;
+            position: absolute;
+            opacity: 0.9;
+            margin-top: -38px;
+            margin-left: -15px;
+        }
+    </style>
 </head>
 <body>
-	<div>
-		<h1>首页</h1>
-		<ul class="mui-table-view mui-table-view-chevron">
-			<li class="mui-table-view-cell">
-				<a class="mui-navigate-right" href="pages/bookstand.html">
-					书架
-				</a>
-			</li>
-		</ul>
-	</div>
-	
+<div>
+    <h1>首页</h1>
+    <!--		<ul class="mui-table-view mui-table-view-chevron">
+                <li class="mui-table-view-cell">
+                    <a class="mui-navigate-right" href="pages/bookstand.html">
+                        书架
+                    </a>
+                </li>
+            </ul>-->
+	<input type="range" id="slider" name="slider" min="0" max="100" step="1">
+</div>
+
 </body>
-</html>
+</html>