|
@@ -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
|
|