Hello everyone, I am attempting to create a ball that has a 50% radius and rolls left based on the user's scroll movements. So far, I have successfully made it move left in relation to ScrollTop, but unfortunately, I cannot get the transform property to function in the same way. Can anyone point out where I might have made a mistake? Below is the code snippet with the left movement working correctly but the transform not:
function parallax(){
var scrolled = $(window).scrollTop();
$('.ball').css('left', (scrolled * 0.9) + 'px');
$('.ball').css('transform', rotate(scrolled * 180) + 'deg');
}
$(window).scroll(function(e){
parallax();
});
Your help and insights are greatly appreciated! Sincerely, Shir