当前位置:Gxlcms > html代码 > 请问这个网页顶部的图片滚动效果是怎么实现的?谢谢_html/css_WEB-ITnose

请问这个网页顶部的图片滚动效果是怎么实现的?谢谢_html/css_WEB-ITnose

时间:2021-07-01 10:21:17 帮助过:17人阅读

就是这个: http://www.nilock.com/2011/05/19/a-parallax-scrolling-demo/comment-page-1/

大家帮我看看,谢谢啦,我是新手……


回复讨论(解决方案)

不停的修改
background-position

应用js做的

这些云都是同一张图片, 然后用JS让他动起来, 看起来有层次感 CSS3 和JS 都可以做!

  1. $( function($) {
  2. var current = 0;
  3. setInterval(function(){
  4. if(current==-6000) {current=0;}
  5. current -=600;
  6. $('#header-background').animate({backgroundPosition:current+"px 0px"},25000);
  7. },2500);
  8. })

修改 background-position

JScript code

$( function($) {
var current = 0;
setInterval(function(){
if(current==-6000) {current=0;}
current -=600;
$('#header-background').an……
++

人气教程排行