zoukankan      html  css  js  c++  java
  • 背景自动滚动

    From:http://bbs.blueidea.com/thread-2970016-1-1.html


    代码
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
    window.onload
    = function(){
    var scrollBackground = {
    object:document.getElementById(
    "scrollBackground"),
    endTop:
    3700,
    nowTop:
    0
    };

    var scrollInterval = setInterval(function(){
    scrollBackground.nowTop
    = (scrollBackground.nowTop!=scrollBackground.endTop)?(scrollBackground.nowTop+1):0;
    scrollBackground.object.style.backgroundPosition
    = "0px -" + scrollBackground.nowTop + "px";
    },
    50);
    }
    </script>
    </head>
    <body style="margin:0; padding:0">
    <div id="scrollBackground" style="1440px; height:300px; background:url(http://youlove.us/template/theme/youloveus/img/bg.jpg) no-repeat 0 0"></div>00;">
    </body>
    </html>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
    window.onload = function(){
    	var scrollBackground = {
    		object:document.getElementById("scrollBackground"),
    		endTop:3700,
    		nowTop:0
    	};
    	
    	var scrollInterval = setInterval(function(){
    		scrollBackground.nowTop = (scrollBackground.nowTop!=scrollBackground.endTop)?(scrollBackground.nowTop+1):0;
    		scrollBackground.object.style.backgroundPosition = "0px -" + scrollBackground.nowTop + "px";
    	},50);
    }
    </script>
    </head>
    <body style="margin:0; padding:0">
    <div id="scrollBackground" style="1440px; height:300px; background:url(http://youlove.us/template/theme/youloveus/img/bg.jpg) no-repeat 0 0"></div>
    </body>
    </html>
    
    
    
  • 相关阅读:
    Android 音视频同步机制
    FFmpeg命令行工具学习(五):FFmpeg 调整音视频播放速度
    Android框架式编程之RxJava
    Android Gradle 学习笔记(一):Gradle 入门
    FFmpeg开发实战(六):使用 FFmpeg 将YUV数据编码为视频文件
    SDL 开发实战(七): SDL 多线程与锁机制
    JNI实战(四):C 调用 Java
    JNI实战(三):JNI 数据类型映射
    JNI实战(二):Java 调用 C
    JNI实战(一):JNI HelloWorld
  • 原文地址:https://www.cnblogs.com/jikey/p/1711013.html
Copyright © 2011-2022 走看看