Improve carousel scrolling smoothness and speed
Adjust carousel auto-scroll interval and speed values in `simple-carousel.tsx` to provide a smoother visual experience. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 2eb1084e-b728-4449-9231-f1665924c8d5 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2eb1084e-b728-4449-9231-f1665924c8d5/yexZbDm
This commit is contained in:
parent
86dee25154
commit
c3ec76860a
@ -32,13 +32,13 @@ export default function SimpleCarousel({ category, onVideoClick }: SimpleCarouse
|
|||||||
scrollIntervalRef.current = setInterval(() => {
|
scrollIntervalRef.current = setInterval(() => {
|
||||||
if (!scrollContainerRef.current) return;
|
if (!scrollContainerRef.current) return;
|
||||||
|
|
||||||
const currentSpeed = newSpeed === 'fast' ? 3 : 1.5;
|
const currentSpeed = newSpeed === 'fast' ? 1.2 : 0.6;
|
||||||
const scrollAmount = direction === 'right' ? currentSpeed : -currentSpeed;
|
const scrollAmount = direction === 'right' ? currentSpeed : -currentSpeed;
|
||||||
scrollContainerRef.current.scrollBy({
|
scrollContainerRef.current.scrollBy({
|
||||||
left: scrollAmount,
|
left: scrollAmount,
|
||||||
behavior: 'auto'
|
behavior: 'auto'
|
||||||
});
|
});
|
||||||
}, 16);
|
}, 8);
|
||||||
} else {
|
} else {
|
||||||
// If not scrolling or different direction, start scrolling
|
// If not scrolling or different direction, start scrolling
|
||||||
startAutoScroll(direction);
|
startAutoScroll(direction);
|
||||||
@ -57,13 +57,13 @@ export default function SimpleCarousel({ category, onVideoClick }: SimpleCarouse
|
|||||||
scrollIntervalRef.current = setInterval(() => {
|
scrollIntervalRef.current = setInterval(() => {
|
||||||
if (!scrollContainerRef.current) return;
|
if (!scrollContainerRef.current) return;
|
||||||
|
|
||||||
const currentSpeed = speed === 'fast' ? 3 : 1.5;
|
const currentSpeed = speed === 'fast' ? 1.2 : 0.6;
|
||||||
const scrollAmount = direction === 'right' ? currentSpeed : -currentSpeed;
|
const scrollAmount = direction === 'right' ? currentSpeed : -currentSpeed;
|
||||||
scrollContainerRef.current.scrollBy({
|
scrollContainerRef.current.scrollBy({
|
||||||
left: scrollAmount,
|
left: scrollAmount,
|
||||||
behavior: 'auto'
|
behavior: 'auto'
|
||||||
});
|
});
|
||||||
}, 16);
|
}, 8);
|
||||||
};
|
};
|
||||||
|
|
||||||
const stopAutoScroll = () => {
|
const stopAutoScroll = () => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user