Browse Source

火狐缓存高度bug。。。doing

laiguoran 5 years ago
parent
commit
b84a1e1e42
1 changed files with 6 additions and 5 deletions
  1. 6 5
      app/view/stage/audit_modal.ejs

+ 6 - 5
app/view/stage/audit_modal.ejs

@@ -1593,20 +1593,21 @@
         // $('#hide-all').hide();
         // return false;
     });
+    
+    // 定位到审批框高度
     $('.modal').on('shown.bs.modal', function () {
-        const height = $(this)[0].scrollHeight
+        const height = $(this)[0].scrollHeight;
         const hdiv = divSearch($(this).find('textarea')) ? $(this).find('textarea') : null;
-        const hdheight = hdiv ? hdiv.parents('.list-group-item').offset().top : 0;
+        const hdheight = hdiv ? hdiv.parents('.list-group-item').offset().top : null;
         const scrollBox = $(this).find('div[class="col-8 modal-height-500"]');
         const bdiv = scrollBox.offset().top;
+
         // 450是modal没有滚动条时的最大高度,超过则出现滚动条,需要自动下拉到底部
         // if (scrollBox.length && scrollBox[0].scrollHeight > 450) {
         //     scrollBox.scrollTop(height);
         // }
-        if (hdiv && hdheight - bdiv > 300) {
+        if (hdiv && scrollBox.length &&  scrollBox[0].scrollHeight > 450 && hdheight - bdiv > 450) {
             scrollBox.scrollTop(hdheight - bdiv);
-        } else if (scrollBox.length && scrollBox[0].scrollHeight > 450) {
-            scrollBox.scrollTop(height);
         }
     });