
Gabriel F. answered 10/11/19
Tutor
5.0
(85)
UI Engineer
Hi there. Just to clarify, this is mainly a JavaScript question, not CSS. To achieve this you need to trigger the carousel on the JavaScript "scroll" event.
var currentScrollPosition = 0;
function doCarouselEffects(scrollPosition) {
// trigger carousel here
// you also have access to the scroll position
// if you want to do something with it
}
window.addEventListener('scroll', function(e) {
// gets the scroll Y (vertical) position
currentScrollPosition = window.scrollY;
doCarouselEffects(currentScrollPosition);
}
It is not clear on the question what else you want to do when page is scrolled but this should give you an idea on how to start.