CSS3滚动时的转换 [英] CSS3 Transformation while scrolling

查看:149
本文介绍了CSS3滚动时的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道一个好的教程来实现这一点? (如此处所示: http://www.contrastrebellion.com/
我看过

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

编辑:此处也显示: http://playgroundinc.com/

我要实现的是:

向下滚动时旋转png,旋转速度与滚动速度相匹配。

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

推荐答案

这应该让你走正确的方向: http://www.ianlunn.co.uk/blog/code-tutorials/recreate-nikebetterworld-parallax/

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

这里:

用于滚动滚动的动画。

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

代码:

var sdegree = 0;

$(window).scroll(function() {

    sdegree ++ ;
    sdegree = sdegree + 3 ;
    var srotate = "rotate(" + sdegree + "deg)";
    $("img").css({"-moz-transform" : srotate, "-webkit-transform" : srotate});
});

这篇关于CSS3滚动时的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆