js模拟腾讯网文本内容定时向上滚动特效

4周前 (04-20 11:35)阅读25回复0
大陆
大陆
  • 管理员
  • 发消息
  • 注册排名1
  • 经验值4494
  • 级别管理员
  • 主题898
  • 回复2
楼主

固定文本框内文本内容定时向上滚动显示特效,这是一款很实用的文字定时向上滚动js特效,可根据自己需求来自定义滚动速度。

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren">
<meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。">
<title>js模拟腾讯网文本内容定时向上滚动特效_武鸣人</title>
<style>
#msg_wuming
{
width: 300px;
height: 186px; *height:186px;_height:170px;margin:10pxauto0;zoom:1;overflow:hidden;font-size:12px;line-height:20px;margin-bottom:4px;background:#ffffff;}
#msg_wuming a
{
margin-right: 6px;
color: #003C71;
text-decoration: none;
}
#msg_wuming a:hover
{
color: #c00;
text-decoration: underline;
}
#msg_wuming img
{
margin-top: 2px;
}
#msg_wuming span
{
color: #888;
}
#msg_wuming div
{
padding: 8px 0 11px 0;
overflow: hidden;
zoom: 1;
}
#msg_wuming span a
{
display: block;
}
#msg_wuming img
{
float: left;
width: 50px;
height: 50px;
padding: 2px;
border: #D6D6D6 1px solid;
}
#msg_wuming p
{
float: left;
width: 295px;
padding-left: 5px;
}
</style>
</head>
<body>
<a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr>
<!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。-->
<script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script>
<script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script>
<div>
<table width="320" cellpadding="0" cellspacing="0" align="left" style="border-collapse: collapse; border: 1px solid black;">
    <tr>
        <td valign="top">
<div class="Contentnr auto">
    <div id="msg_wuming">
        <div class="con">
<p><a href="https://www.wuming.ren" target="_blank">武鸣人一号内容</a>,各种信息免费发布,资源共享合作共赢!</p>
        </div>
        <div class="con">
<p><a href="https://www.wuming.ren" target="_blank">武鸣人二号内容</a>,各种信息免费发布,资源共享合作共赢!</p>
        </div>
        <div class="con">
<p><a href="https://www.wuming.ren" target="_blank">武鸣人三号内容</a>,各种信息免费发布,资源共享合作共赢!</p>
        </div>
        <div class="con">
<p><a href="https://www.wuming.ren" target="_blank">武鸣人四号内容</a>,各种信息免费发布,资源共享合作共赢!</p>
        </div>
        <div class="con">
<p><a href="https://www.wuming.ren" target="_blank">武鸣人五号内容</a>,各种信息免费发布,资源共享合作共赢!</p>
        </div>
        <div class="con">
<p><a href="https://www.wuming.ren" target="_blank">武鸣人六号内容</a>,各种信息免费发布,资源共享合作共赢!</p>
        </div>
        <div class="con">
<p><a href="https://www.wuming.ren" target="_blank">武鸣人七号内容</a>,各种信息免费发布,资源共享合作共赢!</p>
        </div>
        <div class="con">
<p><a href="https://www.wuming.ren" target="_blank">武鸣人八号内容</a>,各种信息免费发布,资源共享合作共赢!</p>
        </div>
        <div class="con">
<p><a href="https://www.wuming.ren" target="_blank">武鸣人九号内容</a>,各种信息免费发布,资源共享合作共赢!</p>
        </div>
    </div>
    </div> 
  </td>
 </tr>
 </table>
<script language="javascript">
var $ = function(d) {
    typeof d == "string" && (d = document.getElementById(d));
    return $.fn.call(d);
};//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
$.fn = function() {
    this.addEvent = function(sEventType, fnHandler) {
if (this.addEventListener) { this.addEventListener(sEventType, fnHandler, false); }
else if (this.attachEvent) { this.attachEvent("on" + sEventType, fnHandler); }
else { this["on" + sEventType] = fnHandler; }
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
    this.removeEvent = function(sEventType, fnHandler) {
if (this.removeEventListener) { this.removeEventListener(sEventType, fnHandler, false); }
else if (this.detachEvent) { this.detachEvent("on" + sEventType, fnHandler); }
else { this["on" + sEventType] = null; }
    }
    return this;
};//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
var Class = { create: function() { return function() { this.initialize.apply(this, arguments); } } };
var Bind = function(obj, fun, arr) { return function() { return fun.apply(obj, arr); } }
var Marquee = Class.create();
Marquee.prototype = {
    initialize: function(id, name, out, speed) {
this.name = name;
this.box = $(id);
this.out = 3; //滚动间隔时间,单位秒
this.speed = speed;
this.d = 1;
this.box.style.position = "relative";
this.box.scrollTop = 0;
var _li = this.box.firstChild;
while (typeof (_li.tagName) == "undefined") _li = _li.nextSibling;
this.lis = this.box.getElementsByTagName(_li.tagName);
this.len = this.lis.length;
for (var i = 0; i < this.lis.length; i++) {
    var __li = document.createElement(_li.tagName);
    __li.innerHTML = this.lis[i].innerHTML;
    this.box.appendChild(__li); //cloneNode
    if (this.lis[i].offsetTop >= this.box.offsetHeight) break;
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
this.Start();
this.box.addEvent("mouseover", Bind(this, function() { clearTimeout(this.timeout); }, []));
this.box.addEvent("mouseout", Bind(this, this.Start, []));
    },
    Start: function() {
clearTimeout(this.timeout);
this.timeout = setTimeout(this.name + ".Up()", this.out * 1000)
    },
    Up: function() {
clearInterval(this.interval);
this.interval = setInterval(this.name + ".Fun()", 10);
    },
    Fun: function() {
this.box.scrollTop += this.speed;
if (this.lis[this.d].offsetTop <= this.box.scrollTop) {
    clearInterval(this.interval);
    this.box.scrollTop = this.lis[this.d].offsetTop;
    this.Start();
    this.d++;
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
if (this.d >= this.len + 1) {
    this.d = 1;
    this.box.scrollTop = 0;
}
    }
};//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
$(window).addEvent("load", function() {
    marquee = new Marquee("msg_wuming", "marquee", 1, 2);
});//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
    </script>
    </div>
</body>
</html>


0
0
收藏0
回帖

js模拟腾讯网文本内容定时向上滚动特效 期待您的回复!

取消
载入表情清单……
载入颜色清单……
插入网络图片

取消确定

图片上传中
编辑器信息
提示信息