瀏覽代碼

中小屏幕不开启滚动条优化功能

jqh 5 年之前
父節點
當前提交
f78d9a4c27
共有 1 個文件被更改,包括 13 次插入11 次删除
  1. 13 11
      src/Layout/Content.php

+ 13 - 11
src/Layout/Content.php

@@ -416,18 +416,20 @@ class Content implements Renderable
         Admin::script(
             <<<'JS'
 (function () {
-    var ps, wps;            
-   if ($('.full-page .wrapper').length) {
-        wps = new PerfectScrollbar('.full-page .wrapper');
+    if ($(window).width() > 768) {
+        var ps, wps;
+        if ($('.full-page .wrapper').length) {
+            wps = new PerfectScrollbar('.full-page .wrapper');
+        }
+        ps = new PerfectScrollbar('html');
+        $(document).one('pjax:send',function () {
+            ps && ps.destroy();
+            ps = null; 
+              
+            wps && wps.destroy();
+            wps = null; 
+        });
     }
-    ps = new PerfectScrollbar('html');
-    $(document).one('pjax:send',function () {
-        ps && ps.destroy();
-        ps = null; 
-          
-        wps && wps.destroy();
-        wps = null; 
-    });
 })()
 JS
         );