Эх сурвалжийг харах

Patient leftnav - preserve scroll position

Vijayakrishnan 3 жил өмнө
parent
commit
f07286c904

+ 1 - 0
public/css/style.css

@@ -480,6 +480,7 @@ input.search_field, textarea.search_field {
         z-index: 8;
         height: calc(100% - 55px);
         overflow-y: overlay;
+        padding-bottom: 4rem;
     }
     .main-row {
         padding-left: 180px;

+ 2 - 2
public/js/mc.js

@@ -177,14 +177,14 @@ function onFastLoaded(_data, _href, _history) {
                 }
                 window.top.currentMcUrl = window.top.location.href;
 
-                let activeLeftNavLink = $('#sidebarMenu .nav-item>.nav-link.active').first();
+                /*let activeLeftNavLink = $('#sidebarMenu .nav-item>.nav-link.active').first();
                 if(activeLeftNavLink.length) {
                     activeLeftNavLink[0].scrollIntoView({
                         behavior: "smooth",
                         block: "nearest",
                         inline: "nearest"
                     });
-                }
+                }*/
             }, 0);
         }
         else {

+ 15 - 0
resources/views/layouts/patient.blade.php

@@ -1031,4 +1031,19 @@
             addMCInitializer('patient-add-note-popup', init, '#patient-header')
         }).call(window);
     </script>
+    <script>
+        (function() {
+            function init() {
+                $('#sidebarMenu')
+                    .off('scroll')
+                    .on('scroll', function() {
+                        localStorage.sidebarMenuScrollTop = $(this).scrollTop();
+                    });
+                if(localStorage.sidebarMenuScrollTop) {
+                    $('#sidebarMenu').scrollTop(+localStorage.sidebarMenuScrollTop);
+                }
+            }
+            addMCInitializer('sidebarMenu', init, '#sidebarMenu')
+        }).call(window);
+    </script>
 @endsection