Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS3 Transformation while scrolling

Does anyone know of a good tutorial to achieve this? (as seen here: http://www.contrastrebellion.com/) I've looked at the code used on that site and finding it awkward to pull out what I need.

Much appreciated, Thanks

Edit: Also seen here: http://playgroundinc.com/

What I want to achieve:

To rotate a png as I scroll down and the speed of rotation to match the speed of scrolling.

like image 217
malicedix Avatar asked Mar 16 '26 00:03

malicedix


1 Answers

This should get you going in the right direction : http://www.ianlunn.co.uk/blog/code-tutorials/recreate-nikebetterworld-parallax/ .

Here you go :

For animating the rotation on scroll .

http://jsfiddle.net/EnSkJ/2/

Code :

var sdegree = 0;

$(window).scroll(function() {

    sdegree ++ ;
    sdegree = sdegree + 3 ;
    var srotate = "rotate(" + sdegree + "deg)";
    $("img").css({"-moz-transform" : srotate, "-webkit-transform" : srotate});
});
like image 139
Infra Stank Avatar answered Mar 17 '26 17:03

Infra Stank



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!