CSS3 Transformation while scrolling

后端 未结 3 977
执笔经年
执笔经年 2021-02-04 21:57

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

3条回答
  •  面向向阳花
    2021-02-04 22:26

    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});
    });
    

提交回复
热议问题