javascript 向上滚动

<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="zh-CN">
<meta name="Keywords" content=",,">
<meta name="Description" content=" /">
<title>SuperSlide - 文字无缝滚动特效-上</title>
<!-- <script src="http://libs.baidu.com/jquery/1.4.2/jquery.min.js"></script> -->

</head>

<body>

<style type="text/css">

    /* css 重置 */
    *{margin:0; padding:0; list-style:none; }
    body{ background:#fff; font:normal 12px/22px 宋体;  }
    img{ border:0;  }
    a{ text-decoration:none; color:#333;  }
    a:hover{ color:#1974A1;  }

    /* 本例子css */
    .txtMarquee-top{ overflow:hidden; position:relative;  border:1px solid #ccc;   }
    .txtMarquee-top .hd{ overflow:hidden;  height:30px; background:#f4f4f4; padding:0 10px;  }
    .txtMarquee-top .hd .prev,.txtMarquee-top .hd .next{ display:block;  width:9px; height:5px; float:right; margin-right:5px; margin-top:10px;  overflow:hidden;
         cursor:pointer; background:url("../images/arrow.png") 0 -100px no-repeat;}
    .txtMarquee-top .hd .next{ background-position:0 -140px;  }
    .txtMarquee-top .hd .prevStop{ background-position:-60px -100px;  }
    .txtMarquee-top .hd .nextStop{ background-position:-60px -140px;  }
    .txtMarquee-top .bd{ padding:15px;  }
    .txtMarquee-top .infoList li{ height:24px; line-height:24px;   }
    .txtMarquee-top .infoList li .date{ float:right; color:#999;  }

</style>

        <div class="txtMarquee-top">
            <div class="bd">
                <div class="tempWrap" id="tempWrap" style="overflow:hidden; position:relative; height:120px" >
                    <ul class="infoList" id="infoList" style="position: relative; padding: 0px; margin: 0px; top: 0px;" >
                        <li class="clone" style="height: 24px;"><span class="date">2011-11-11</span><a href="#" target="_blank">那些无法理解的荒唐事</a></li>
                        <li style="height: 24px;"><span class="date">2011-11-11</span><a href="#" target="_blank">中国打破了世界软件巨头规则</a></li>
                        <li style="height: 24px;"><span class="date">2011-11-11</span><a href="#" target="_blank">口语:会说中文就能说英语!</a></li>
                        <li style="height: 24px;"><span class="date">2011-11-11</span><a href="#" target="_blank">农场摘菜不如在线学外语好玩</a></li>
                        <li style="height: 24px;"><span class="date">2011-11-11</span><a href="#" target="_blank">数理化老师竟也看学习资料?</a></li>
                        <li style="height: 24px;"><span class="date">2011-11-11</span><a href="#" target="_blank">学英语送ipad2,45天突破听说</a></li>
                        <li style="height: 24px;"><span class="date">2011-11-11</span><a href="#" target="_blank">学外语,上北外!</a></li>
                        <li style="height: 24px;"><span class="date">2011-11-11</span><a href="#" target="_blank">那些无法理解的荒唐事</a></li>
                        <li class="clone" style="height: 24px;"><span class="date">2011-11-11</span><a href="#" target="_blank">中国打破了世界软件巨头规则</a></li>
                        <li class="clone" style="height: 24px;"><span class="date">2011-11-11</span><a href="#" target="_blank">口语:会说中文就能说英语!</a></li>
                        <li class="clone" style="height: 24px;"><span class="date">2011-11-11</span><a href="#" target="_blank">农场摘菜不如在线学外语好玩</a></li>
                        <li class="clone" style="height: 24px;"><span class="date">2011-11-11</span><a href="#" target="_blank">数理化老师竟也看学习资料?</a></li>
                        <li class="clone" style="height: 24px;"><span class="date">2011-11-11</span><a href="#" target="_blank">学英语送ipad2,45天突破听说</a></li>
                    </ul>
                </div>
            </div>
        </div>

        <script type="text/javascript">

            window.onload=function(){

                var InfoList = document.getElementById(‘infoList‘);
                var li = document.getElementsByTagName(‘li‘);
                var TempWrap = document.getElementById(‘tempWrap‘);
                var HTempWrap = TempWrap.offsetHeight;
                var HInfoList = InfoList.offsetHeight;
                var index = 0;
                var Hli = li[0].offsetHeight;
                var Lli = li.length;
                InfoList.style.height = Hli*Lli;
                var info = (HInfoList-HTempWrap)*-1;

                Timeint = setInterval(setTime,500)

                TempWrap.onmouseover = function(){
                    clearInterval(Timeint);
                };
                TempWrap.onmouseout = function(){
                    Timeint = setInterval(setTime,500);
                }
                function setTime(){

                    index --;
                    if(index <= info){
                        index = -1;
                        return false;
                    }else{
                        index = index+-3;
                        InfoList.style.top = index+‘px‘;
                    }
                }

            }

        </script>

</body>
</html>

效果图:

时间: 2024-08-29 23:27:38

javascript 向上滚动的相关文章

文字列表无缝向上滚动JavaScript代码

<!DOCTYPE html> <html> <head> <meta charset=utf-8> <title>文字列表无缝向上滚动JavaScript代码-代码库</title> <style> *{margin:0px;padding:0px;border:0px;} body{font-size:12px} a{color:#333333; text-decoration:none;} a:hover{color

javascript无缝滚动

无缝滚动好像是互联网广告最大的一个载体,可以用“无处不在”来形容它.不过它比起早期的闪光字体,浮动广告算进步了.由于需求巨大,做前台迟早会遇到它.我先给出结构层部分,再慢慢讲解其实现原理. <dl id="marquee">   <dt>     <img src="http://images.cnblogs.com/cnblogs_com/rubylouvre/199042/o_s017.jpg" alt="无缝滚动&quo

练习题:间歇性向上滚动

1 <!DOCTYPE html > 2 <html > 3 <head> 4 <meta charset=utf-8" /> 5 <title>新闻间歇性向上滚动</title> 6 <style> 7 body { 8 font-size: 12px; 9 line-height: 24px; 10 text-algin: center; /* 页面内容居中 */ 11 } 12 * { 13 margin:

javascript鼠标中键滚动事件介绍

javascript鼠标中键滚动事件介绍:在实际应用中,鼠标的一些事件非常常用,例如,onclick事件.onmouseover事件等,这里就不介绍了,具体可以参阅javascript的onclick事件和javascript的onmouseover事件一章节. 还有一种事件比较少用,那就是鼠标中键滚轮滚动事件,下面就通过代码实例简单介绍一下中键滚轮事件.IE浏览器和谷歌浏览器支持mousewheel事件,也就是鼠标中键滚动事件,但是遗憾的是火狐浏览器并不支持此事件,而是支持DOMMouseSc

图片不断向上滚动

<!DOCTYPE html><html>    <head>        <meta charset="utf-8">        <title></title>        <script src="http://cdn.bootcss.com/jquery/1.8.3/jquery.min.js"></script>        <style type

js制作无缝向上滚动的广告

---------------------------------------------------------------------------------------------------------------css @charset "gb2312";/* CSS Document */ body{ margin:0; margin-top:3px; padding:0; font-size:12px; line-height:20px; color:#333;}.dom

文字向上滚动代码,带段落停顿

带段落停顿效果的文字向上滚动代码,一个比较早的代码了,但觉得现在仍很常用,它可以定义文字成批次(段落)向上滚动,滚动后停顿,然后继续滚动,很不错啦,希望大家也喜欢. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>接触角测定仪</title> </head> &l

jquery实现文字向上滚动显示效果的简易方法(个人随笔)

HTML代码: <!doctype html> <html> <head> <meta charset="utf-8"> <title>文字向上滚动</title> <link type="text/css" rel="stylesheet" href="style/style.css"/> <script type="text

实现窗口中的文档自动向上滚动,方便阅读

<!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" xml:lang="en"> <head> <meta ht