开发者

Vimeo floating Sun?

开发者 https://www.devze.com 2023-03-14 22:02 出处:网络
I\'m just wondering if anyone knows how they make Vimeo floating su开发者_Go百科n. http://vimeo.com/

I'm just wondering if anyone knows how they make Vimeo floating su开发者_Go百科n. http://vimeo.com/

using jQuery .scroll function ?

anyone can give me a head start?


fiddle: http://jsfiddle.net/KpPCj/

html:

<img src="http://a.vimeocdn.com/images/land_sun.gif" id="sun" />

jquery:

$(document).scroll(function() {    
    $('#sun').stop(true,true).animate({
        top: $(document).scrollTop() * -1
    }, 2000);
});

css:

body {
    background-color: #cbe8ff;
    height:1000px;
}

#sun {
    position:absolute;
    top:0px;
    left:-10px;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消