Posted in Images

Rotating Element On Scrolling

$(window).scroll(function() {

// get the variable of how far we’ve scrolled from the top
var offset = $(window).scrollTop();
offset     = offset / 4;

// add css transform with the offset variable
$(‘#sp-links a’).css({
‘-moz-transform’: ‘rotate(‘ + offset + ‘deg)’,
‘-webkit-transform’: ‘rotate(‘ + offset + ‘deg)’,
‘-o-transform’: ‘rotate(‘ + offset + ‘deg)’,
‘-ms-transform’: ‘rotate(‘ + offset + ‘deg)’,
‘transform’: ‘rotate(‘ + offset + ‘deg)’,
});

});

Refference: http://codepen.io/sevilayha/pen/mlJbD

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s