Browse Source

revert testing

master
farhan 4 months ago
parent
commit
cad689852c
2 changed files with 11 additions and 15 deletions
  1. 0
    4
      resources/css/app.css
  2. 11
    11
      resources/js/app.js

+ 0
- 4
resources/css/app.css View File

36
 html {
36
 html {
37
     scroll-behavior: smooth;
37
     scroll-behavior: smooth;
38
 }
38
 }
39
-body {
40
-    min-height: 100vh; /* Minimum height of the body */
41
-    overflow-y: scroll; /* Always show vertical scrollbar */
42
-}
43
 body.no-scroll {
39
 body.no-scroll {
44
     overflow: hidden;
40
     overflow: hidden;
45
 }
41
 }

+ 11
- 11
resources/js/app.js View File

55
 $(function() {
55
 $(function() {
56
     var partLeftPos = 0;
56
     var partLeftPos = 0;
57
     var partRightPos = 0;
57
     var partRightPos = 0;
58
-    
59
-    // Function to update positions of .left and .right elements
58
+
60
     function updatePositions() {
59
     function updatePositions() {
61
         var distance = $(window).scrollTop() * 2;
60
         var distance = $(window).scrollTop() * 2;
62
         var left = partLeftPos - distance;
61
         var left = partLeftPos - distance;
63
         var right = partRightPos - distance;
62
         var right = partRightPos - distance;
64
-        
63
+
65
         $('.left').css('left', left + "px");
64
         $('.left').css('left', left + "px");
66
         $('.right').css('right', right + "px");
65
         $('.right').css('right', right + "px");
67
 
66
 
82
     // Initial positions update
81
     // Initial positions update
83
     updatePositions();
82
     updatePositions();
84
 
83
 
85
-    // Update positions on scroll
84
+    // Listen to scroll events using requestAnimationFrame for smooth animation
85
+    var ticking = false;
86
     $(window).scroll(function() {
86
     $(window).scroll(function() {
87
-        updatePositions();
88
-    });
89
-
90
-    // Ensure scrollbar visibility
91
-    $('body').css({
92
-        'min-height': '100vh', // Set minimum height to viewport height
93
-        'overflow-y': 'scroll' // Always show vertical scrollbar
87
+        if (!ticking) {
88
+            window.requestAnimationFrame(function() {
89
+                updatePositions();
90
+                ticking = false;
91
+            });
92
+        }
93
+        ticking = true;
94
     });
94
     });
95
 });
95
 });
96
 
96
 

Loading…
Cancel
Save