Ver Fonte

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

jqh há 5 anos atrás
pai
commit
f78d9a4c27
1 ficheiros alterados com 13 adições e 11 exclusões
  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
         );