相思资源网 Design By www.200059.com
在线演示:http://demo.jb51.net/js/2012/callboard/
jQuery代码
复制代码 代码如下:
//第二版:Newton改造
(function (win){
var callboarTimer;
var callboard = $('#callboard');
var callboardUl = callboard.find('ul');
var callboardLi = callboard.find('li');
var liLen = callboard.find('li').length;
var initHeight = callboardLi.first().outerHeight(true);
win.autoAnimation = function (){
if (liLen <= 1) return;
var self = arguments.callee;
var callboardLiFirst = callboard.find('li').first();
callboardLiFirst.animate({
marginTop:-initHeight
}, 500, function (){
clearTimeout(callboarTimer);
callboardLiFirst.appendTo(callboardUl).css({marginTop:0});
callboarTimer = setTimeout(self, 5000);
});
}
callboard.mouseenter(
function (){
clearTimeout(callboarTimer);
}).mouseleave(function (){
callboarTimer = setTimeout(win.autoAnimation, 5000);
});
}(window));
setTimeout(window.autoAnimation, 5000);
HTML代码:
复制代码 代码如下:
<div id="callboard">
<ul>
<li>
<a href="http://www.qianduanzu.com/2012042036.html">公告:前端组主题正在整理中..有需要用的朋友请留个言,以方便及时通知!</a>
</li>
<li>
<span style="color:red;">公告:前端组上线一个月零八天,PR升为3,BD权重1</span>
</li>
</ul>
CSS代码:(可根据需求另设)
复制代码 代码如下:
#callboard { height:24px; line-height:24px; overflow:hidden;}
#callboard ul { padding:0;}
#callboard li { padding:0;}
完整演示代码:
复制代码 代码如下:
<!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>
<style type="text/css">
header, nav, aside, menu, figure, article, footer { display:block; }
body, div, form, textarea, label, input, ul, ol, li, dl, dt, dd, p, span, a, img, h1, h2, h3, h4, h5, h6, tbody, tfoot, tr, th, td, pre, code, form, fieldset, legend, font { margin:0; padding:0; }
table { border-collapse:collapse; border-spacing:0; }
caption, th { text-align:left; }
sup { vertical-align:text-top; }
sub { vertical-align:text-bottom; }
li { list-style:none; }
fieldset, img { border:none; }
input, textarea, select { font-family:inherit; font-size:inherit; font-weight:inherit; *font-size:100%;
color:inherit; _color:#333; *color:#333;
outline:none; }
/*BASE CLASS*/
.cfix { *display:inline-block;*zoom:1}
.cfix:after { content:"."; display:block; height:0; clear:both; visibility:hidden; }
/*公告栏滚动CSS*/
#callboard { width:600px; margin:100px auto 0; height:24px; line-height:24px; overflow:hidden; font-size:12px; background-color:#f5f5f5;}
#callboard ul { padding:0; }
#callboard li { padding:0; }
</style>
<script type="text/javascript" src="/UploadFiles/2021-04-02/jquery-1.7.2.min.js"></head>
<body>
<div id="callboard">
<ul>
<li>
<span style="color:red;">公告[2]:前端组上线一个月零八天,PR升为3,BD权重1</span>
</li>
<li>
<span style="color:red;">公告[3]:撤下了BloggerAds,原因为收入太少,打开速度慢!</span>
</li>
<li style="margin-top: 0px;">
<a href="https://www.jb51.net">公告[1]:前端组主题正在整理中..有需要用的朋友请留个言,以方便及时通知!</a>
</li>
</ul>
</div>
<!--公告板滚动-->
<script type="text/javascript">
(function (win){
var callboarTimer;
var callboard = $('#callboard');
var callboardUl = callboard.find('ul');
var callboardLi = callboard.find('li');
var liLen = callboard.find('li').length;
var initHeight = callboardLi.first().outerHeight(true);
win.autoAnimation = function (){
if (liLen <= 1) return;
var self = arguments.callee;
var callboardLiFirst = callboard.find('li').first();
callboardLiFirst.animate({
marginTop:-initHeight
}, 500, function (){
clearTimeout(callboarTimer);
callboardLiFirst.appendTo(callboardUl).css({marginTop:0});
callboarTimer = setTimeout(self, 5000);
});
}
callboard.mouseenter(
function (){
clearTimeout(callboarTimer);
}).mouseleave(function (){
callboarTimer = setTimeout(win.autoAnimation, 5000);
});
}(window));
setTimeout(window.autoAnimation, 5000);
</script>
</body>
</html>
jQuery代码
复制代码 代码如下:
//第二版:Newton改造
(function (win){
var callboarTimer;
var callboard = $('#callboard');
var callboardUl = callboard.find('ul');
var callboardLi = callboard.find('li');
var liLen = callboard.find('li').length;
var initHeight = callboardLi.first().outerHeight(true);
win.autoAnimation = function (){
if (liLen <= 1) return;
var self = arguments.callee;
var callboardLiFirst = callboard.find('li').first();
callboardLiFirst.animate({
marginTop:-initHeight
}, 500, function (){
clearTimeout(callboarTimer);
callboardLiFirst.appendTo(callboardUl).css({marginTop:0});
callboarTimer = setTimeout(self, 5000);
});
}
callboard.mouseenter(
function (){
clearTimeout(callboarTimer);
}).mouseleave(function (){
callboarTimer = setTimeout(win.autoAnimation, 5000);
});
}(window));
setTimeout(window.autoAnimation, 5000);
HTML代码:
复制代码 代码如下:
<div id="callboard">
<ul>
<li>
<a href="http://www.qianduanzu.com/2012042036.html">公告:前端组主题正在整理中..有需要用的朋友请留个言,以方便及时通知!</a>
</li>
<li>
<span style="color:red;">公告:前端组上线一个月零八天,PR升为3,BD权重1</span>
</li>
</ul>
CSS代码:(可根据需求另设)
复制代码 代码如下:
#callboard { height:24px; line-height:24px; overflow:hidden;}
#callboard ul { padding:0;}
#callboard li { padding:0;}
完整演示代码:
复制代码 代码如下:
<!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>
<style type="text/css">
header, nav, aside, menu, figure, article, footer { display:block; }
body, div, form, textarea, label, input, ul, ol, li, dl, dt, dd, p, span, a, img, h1, h2, h3, h4, h5, h6, tbody, tfoot, tr, th, td, pre, code, form, fieldset, legend, font { margin:0; padding:0; }
table { border-collapse:collapse; border-spacing:0; }
caption, th { text-align:left; }
sup { vertical-align:text-top; }
sub { vertical-align:text-bottom; }
li { list-style:none; }
fieldset, img { border:none; }
input, textarea, select { font-family:inherit; font-size:inherit; font-weight:inherit; *font-size:100%;
color:inherit; _color:#333; *color:#333;
outline:none; }
/*BASE CLASS*/
.cfix { *display:inline-block;*zoom:1}
.cfix:after { content:"."; display:block; height:0; clear:both; visibility:hidden; }
/*公告栏滚动CSS*/
#callboard { width:600px; margin:100px auto 0; height:24px; line-height:24px; overflow:hidden; font-size:12px; background-color:#f5f5f5;}
#callboard ul { padding:0; }
#callboard li { padding:0; }
</style>
<script type="text/javascript" src="/UploadFiles/2021-04-02/jquery-1.7.2.min.js"></head>
<body>
<div id="callboard">
<ul>
<li>
<span style="color:red;">公告[2]:前端组上线一个月零八天,PR升为3,BD权重1</span>
</li>
<li>
<span style="color:red;">公告[3]:撤下了BloggerAds,原因为收入太少,打开速度慢!</span>
</li>
<li style="margin-top: 0px;">
<a href="https://www.jb51.net">公告[1]:前端组主题正在整理中..有需要用的朋友请留个言,以方便及时通知!</a>
</li>
</ul>
</div>
<!--公告板滚动-->
<script type="text/javascript">
(function (win){
var callboarTimer;
var callboard = $('#callboard');
var callboardUl = callboard.find('ul');
var callboardLi = callboard.find('li');
var liLen = callboard.find('li').length;
var initHeight = callboardLi.first().outerHeight(true);
win.autoAnimation = function (){
if (liLen <= 1) return;
var self = arguments.callee;
var callboardLiFirst = callboard.find('li').first();
callboardLiFirst.animate({
marginTop:-initHeight
}, 500, function (){
clearTimeout(callboarTimer);
callboardLiFirst.appendTo(callboardUl).css({marginTop:0});
callboarTimer = setTimeout(self, 5000);
});
}
callboard.mouseenter(
function (){
clearTimeout(callboarTimer);
}).mouseleave(function (){
callboarTimer = setTimeout(win.autoAnimation, 5000);
});
}(window));
setTimeout(window.autoAnimation, 5000);
</script>
</body>
</html>
标签:
公告,无限循环,滚动
相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com
暂无基于jQuery的公告无限循环滚动实现代码的评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?