Rotate logo on scroll

Marko Krstić
29 Dec 2020

If you need to rotate logo while you are scrolling the page like on Matthias Altmann’s website here is the code he shared with us

(function($) {
	$(document).ready(function(){
		$(window).scroll(function() {
		var deg = $(window).scrollTop()/2;
		$('#header-company-logo').css({ transform: 'rotate(' + deg + 'deg)' });
		});
	});
})(jQuery);

Example: https://www.altmann.de/

Was this article helpful?

Tags

Categories

Never miss new post again

Subscribe and get list of new posts in your inbox

Click to Copy