jquery 单行滚动、批量多行滚动、文字图片翻屏滚动效果代码 - Web前端
作者:98wpeu发布时间:2026-10-04分类:网页前端技术浏览:12
导读:以下代码,运行后,需要刷新下,才能加载JQuery,要不然看不到效果。1、单行滚动效果无标题文档ul,li{margin:0;padding:0}#scrollDiv{widt...
以下代码,运行后,需要刷新下,才能加载JQuery,要不然看不到效果。
1、单行滚动效果

无标题文档 ul,li{margin:0;padding:0} #scrollDiv{width:300px;height:25px;line-height:25px;border:#ccc 1px solid;overflow:hidden} #scrollDiv li{height:25px;padding-left:10px;} function AutoScroll(obj){ $(obj).find("ul:first").Animate({ margintop:"-25px" },500,function(){ $(this).CSS({marginTop:"0px"}).find("li:first").appendTo(this); }); } $(document).ready(function(){ SetInterval('AutoScroll("#scrollDiv")',1000) });
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
二,多行滚动效果

无标题文档 ul,li{margin:0;padding:0} #scrollDiv{width:300px;height:100px;min-height:25px;line-height:25px;border:#ccc 1px solid;overflow:hidden} #scrollDiv li{height:25px;padding-left:10px;} //滚动插件 (function($){ $.fn.extend({ Scroll:function(opt,callback){ //参数初始化 if(!opt) var opt={}; var _this=this.eq(0).find("ul:first"); var lineH=_this.find("li:first").height(), //获取行高 line=opt.line?parseInt(opt.line,10):parseInt(this.height()/lineH,10), //每次滚动的行数,默认为一屏,即父容器高度 speed=opt.speed?parseInt(opt.speed,10):500, //卷动速度,数值越大,速度越慢(毫秒) timer=opt.timer?parseInt(opt.timer,10):3000; //滚动的时间间隔(毫秒) if(line==0) line=1; var upHeight=0-line*lineH; //滚动函数 scRollup=function(){ _this.animate({ marginTop:upHeight },speed,function(){ for(i=1;i
1、单行滚动效果

无标题文档 ul,li{margin:0;padding:0} #scrollDiv{width:300px;height:25px;line-height:25px;border:#ccc 1px solid;overflow:hidden} #scrollDiv li{height:25px;padding-left:10px;} function AutoScroll(obj){ $(obj).find("ul:first").Animate({ margintop:"-25px" },500,function(){ $(this).CSS({marginTop:"0px"}).find("li:first").appendTo(this); }); } $(document).ready(function(){ SetInterval('AutoScroll("#scrollDiv")',1000) });
- 百度www.bAIdu.com
- 脚本之家 www.jb51.net
- 这是公告标题的第三行
- 这是公告标题的第四行
- 这是公告标题的第五行
- 这是公告标题的第六行
- 这是公告标题的第七行
- 这是公告标题的第八行
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
二,多行滚动效果

无标题文档 ul,li{margin:0;padding:0} #scrollDiv{width:300px;height:100px;min-height:25px;line-height:25px;border:#ccc 1px solid;overflow:hidden} #scrollDiv li{height:25px;padding-left:10px;} //滚动插件 (function($){ $.fn.extend({ Scroll:function(opt,callback){ //参数初始化 if(!opt) var opt={}; var _this=this.eq(0).find("ul:first"); var lineH=_this.find("li:first").height(), //获取行高 line=opt.line?parseInt(opt.line,10):parseInt(this.height()/lineH,10), //每次滚动的行数,默认为一屏,即父容器高度 speed=opt.speed?parseInt(opt.speed,10):500, //卷动速度,数值越大,速度越慢(毫秒) timer=opt.timer?parseInt(opt.timer,10):3000; //滚动的时间间隔(毫秒) if(line==0) line=1; var upHeight=0-line*lineH; //滚动函数 scRollup=function(){ _this.animate({ marginTop:upHeight },speed,function(){ for(i=1;i
- 网页前端技术排行
-
- 1[Web前端]用javascript实现默认图片替代未显示的图片 - Web前端
- 2分析Iconfont-阿里巴巴矢量常用图标库 - Web前端
- 3jQuery实例教程:制作网页中可折叠的面板 - Web前端
- 4【第六章】Foundation之按钮和下拉功能 - Web前端
- 5基于jquery的滚动条滚动固定div(附演示下载) - Web前端
- 6jQuery编写widget的一些技巧分享 - Web前端
- 7分享精心挑选的12款优秀jQuery Ajax分页插件和教程 - Web前端
- 8jQuery实现鼠标移到元素上动态提示消息框效果 - Web前端
- 9在Mac/PC上远程调试iPhone/iPad上的网页 - Web前端
- 最近发表
-
- WordPress随机显示特色图片插件:Random Post Thumbnails
- KeePass实现Chrome浏览器自动填充密码方法一
- LNMP一键包nginx 301强制跳转到https教程
- KeePass实现Chrome浏览器自动填充密码方法二
- #建站# 免费的VPS管理软件Xshell8/Xftp8中文版下载
- 使用Xshell 8连接VPS教程_电脑登录vps的方法
- WordPress评论界面添加烟花????效果
- 不同浏览器书签同步方案:坚果云+Floccus_详细使用教程
- iOS端KeePassXC客户端APP:Strongbox Password Safe
- 给WordPress评论中的Gravatar头像图片添加ALT属性


