Rotate Element on Scroll

 
 

Javascript

  • Update 50% to make the object rotate faster or slower. The higher the number, the slower it will spin.

  • Change the block ID

Make sure you have the library installed in your Page Injections > Header

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>  
  $(window).on('scroll', function () {
  var amountToRotate = $(window).scrollTop() / 50% (Math.PI*2);
  $('#block-yui_3_17_2_1_1663788116366_2365').css('transform', 'rotate('+ amountToRotate + 'rad)')
});
</script>

Previous
Previous

Responsive Split Screen

Next
Next

Image Reveal on Hover