Browse Source

修改预览页面工具栏的布局;增加对键盘左右键翻页的容错处理

sunyj 9 years ago
parent
commit
d1f775efe8

+ 11 - 11
src/main/webapp/WEB-INF/views/preview2.html

@@ -10,17 +10,6 @@
 <body>
 <body>
 	<div id="toolbarContainer">
 	<div id="toolbarContainer">
 		<div id="toolbarViewerLeft">
 		<div id="toolbarViewerLeft">
-			<button id="prev" title="上页">
-				<i class="fa fa-arrow-left fa-lg" aria-hidden="true"></i>
-			</button>
-			<button id="next" title="下页">
-				<i class="fa fa-arrow-right fa-lg" aria-hidden="true"></i>
-			</button>
-			<span>Page: <input id="pageIndex" type="text" /> / <span
-				id="pageSize"></span></span>
-		</div>
-
-		<div id="toobarViewerCenter">
 			<button id="zoomOut" title="缩小">
 			<button id="zoomOut" title="缩小">
 				<i class="fa fa-minus fa-lg" aria-hidden="true"></i>
 				<i class="fa fa-minus fa-lg" aria-hidden="true"></i>
 			</button>
 			</button>
@@ -42,6 +31,17 @@
 			</label>
 			</label>
 		</div>
 		</div>
 
 
+		<div id="toobarViewerCenter">
+			<button id="prev" title="上页">
+				<i class="fa fa-arrow-left fa-lg" aria-hidden="true"></i>
+			</button>
+			<span>Page: <input id="pageIndex" type="text" /> / <span
+				id="pageSize"></span></span>
+			<button id="next" title="下页">
+				<i class="fa fa-arrow-right fa-lg" aria-hidden="true"></i>
+			</button>
+		</div>
+
 		<div id="toolbarViewerRight">
 		<div id="toolbarViewerRight">
 			<button id="print" title="打印">
 			<button id="print" title="打印">
 				<i class="fa fa-print fa-lg" aria-hidden="true"></i>
 				<i class="fa fa-print fa-lg" aria-hidden="true"></i>

+ 3 - 1
src/main/webapp/resources/css/preview2.css

@@ -19,6 +19,7 @@ button {
 	position: fixed;
 	position: fixed;
 	width: 100%;
 	width: 100%;
 	height: 40px;
 	height: 40px;
+	top: 0;
 	line-height: 40px;
 	line-height: 40px;
 }
 }
 
 
@@ -85,5 +86,6 @@ select::-ms-expand {
 
 
 #viewerContainer {
 #viewerContainer {
 	text-align: center;
 	text-align: center;
-	padding: 50px 0px 10px 0px;
+	margin-top: 50px;
+	margin-bottom: 10px;
 }
 }

+ 2 - 3
src/main/webapp/resources/js/preview2/app.js

@@ -91,8 +91,8 @@ $("#downloadExcelWithOnlyData").click(function() {
 // 键盘左右键进行翻页
 // 键盘左右键进行翻页
 $("body").keydown(function(event) {
 $("body").keydown(function(event) {
 	// 如果在input输入框内按左右键,不进行翻页
 	// 如果在input输入框内按左右键,不进行翻页
-	var activeElement = document.activeElement;
-	if (activeElement.nodeName.toLowerCase() == "input") {
+	var activeElementNodeName = document.activeElement.nodeName.toLowerCase();
+	if (activeElementNodeName == "input" || activeElementNodeName == "select") {
 		return;
 		return;
 	}
 	}
 	if (event.keyCode == 37) {// left
 	if (event.keyCode == 37) {// left
@@ -180,7 +180,6 @@ function renderPage() {
 			// 调整pdf显示的宽度接近窗口宽度
 			// 调整pdf显示的宽度接近窗口宽度
 			scale = getScale(page, 0.95);
 			scale = getScale(page, 0.95);
 		}
 		}
-		console.log(scale);
 		var viewport = page.getViewport(scale);
 		var viewport = page.getViewport(scale);
 		canvas.height = viewport.height;
 		canvas.height = viewport.height;
 		canvas.width = viewport.width;
 		canvas.width = viewport.width;