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,10 +36,6 @@
36 36
 html {
37 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 39
 body.no-scroll {
44 40
     overflow: hidden;
45 41
 }

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

@@ -55,13 +55,12 @@ const countdownTimer = setInterval(() => {
55 55
 $(function() {
56 56
     var partLeftPos = 0;
57 57
     var partRightPos = 0;
58
-    
59
-    // Function to update positions of .left and .right elements
58
+
60 59
     function updatePositions() {
61 60
         var distance = $(window).scrollTop() * 2;
62 61
         var left = partLeftPos - distance;
63 62
         var right = partRightPos - distance;
64
-        
63
+
65 64
         $('.left').css('left', left + "px");
66 65
         $('.right').css('right', right + "px");
67 66
 
@@ -82,15 +81,16 @@ $(function() {
82 81
     // Initial positions update
83 82
     updatePositions();
84 83
 
85
-    // Update positions on scroll
84
+    // Listen to scroll events using requestAnimationFrame for smooth animation
85
+    var ticking = false;
86 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