소스 검색

同步校正

namejr 4 년 전
부모
커밋
2de7818363
1개의 변경된 파일13개의 추가작업 그리고 13개의 파일을 삭제
  1. 13 13
      EBook.Web/Common/tasklib_book.js

+ 13 - 13
EBook.Web/Common/tasklib_book.js

@@ -381,29 +381,28 @@ function bindEventTeaOrignalYS() {
         var curAlt = $(this).attr("alt");//播放视频地址
         playVisiableAudioCallBack(2, $(this).attr("alt"));
     });
-    //处理表格样式
     $("td").attr("style", "");
+    //处理表格样式
+    $(".container-table").each(function (index, item) {
+        var TableWidth = isNaN(parseFloat($(item).find("table").css("width"))) ? 0 : parseFloat($(item).find("table").css("width"));
+        var ScrollLeft = isNaN(parseFloat($(item).scrollLeft())) ? 0 : parseFloat($(item).scrollLeft());
+        var SSWidth = 2 * bodyWidth - TableWidth;  // 显示滚动条宽度
+        if (TableWidth > bodyWidth) {
+            var HtmlStr = "<div class='ShowSBar' style='width:" + bodyWidth + "px;height:5px;background-color:#eee;position:relative;left:0px;bottom:3px;z-index:2;'><div class='ShowSBarC' style='width:" + SSWidth + "px;height:5px;background-color:#ccc;position:absolute;left:" + ScrollLeft + "px;bottom:0px;z-index:3;'></div></div>";
+            $(item).after(HtmlStr);
+        }
+    });
     $(".container-table").on("touchstart", function () {
         var TableWidth = isNaN(parseFloat($(this).find("table").css("width"))) ? 0 : parseFloat($(this).find("table").css("width"));
         if (TableWidth > bodyWidth) {
             pressTableFlag = true;
-            var ShowSBarName = $(this).next().attr("class");
-            if (ShowSBarName != "ShowSBar") {
-                var HtmlStr = "<div class='ShowSBar' style='width:" + bodyWidth + "px;height:5px;background-color:#eee;position:relative;left:0px;bottom:3px;z-index:2;'></div>";
-                $(this).after(HtmlStr);
-            }
         }
     }).on("touchmove", function () {
         var TableWidth = isNaN(parseFloat($(this).find("table").css("width"))) ? 0 : parseFloat($(this).find("table").css("width"));
         var ScrollLeft = isNaN(parseFloat($(this).scrollLeft())) ? 0 : parseFloat($(this).scrollLeft());
         var SSWidth = 2 * bodyWidth - TableWidth;  // 显示滚动条宽度
         var ShowSBarName = $(this).next().attr("class");
-        if (ScrollLeft >= 0 && ShowSBarName == "ShowSBar" && $(this).next().find(".ShowSBarC").length == 0) {
-            // 没有滚动条添加滚动条
-            var AddSWidth = "<div class='ShowSBarC' style='width:" + SSWidth + "px;height:5px;background-color:#ccc;position:absolute;left:" + ScrollLeft + "px;bottom:3px;z-index:3;'></div>";
-            $(this).next().append(AddSWidth);
-        }
-        else if (ScrollLeft >= 0 && ShowSBarName == "ShowSBar" && $(this).next().find(".ShowSBarC").length > 0) {
+        if (ScrollLeft >= 0 && ShowSBarName == "ShowSBar" && $(this).next().find(".ShowSBarC").length > 0) {
             // 有滚动条的进行移动
             $(this).next().find(".ShowSBarC").css("left", ScrollLeft + "px");
         }
@@ -635,9 +634,11 @@ function bindEventYS() {
         var curAlt = $(this).attr("alt");//播放视频地址
         playVisiableAudioCallBack(2, $(this).attr("alt"));
     });
+    $("td").attr("style", "");
     //处理表格样式
     $(".container-table").each(function (index, item) {
         var TableWidth = isNaN(parseFloat($(item).find("table").css("width"))) ? 0 : parseFloat($(item).find("table").css("width"));
+        console.log(TableWidth);
         var ScrollLeft = isNaN(parseFloat($(item).scrollLeft())) ? 0 : parseFloat($(item).scrollLeft());
         var SSWidth = 2 * bodyWidth - TableWidth;  // 显示滚动条宽度
         if (TableWidth > bodyWidth) {
@@ -645,7 +646,6 @@ function bindEventYS() {
             $(item).after(HtmlStr);
         }
     });
-    $("td").attr("style", "");
     $(".container-table").on("touchstart", function () {
         var TableWidth = isNaN(parseFloat($(this).find("table").css("width"))) ? 0 : parseFloat($(this).find("table").css("width"));
         if (TableWidth > bodyWidth) {