联系我们
简单又实用的WordPress网站制作教学
当前位置:网站首页 > 网页前端技术 > 正文

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) });
  • 百度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

标签:批量效果文字代码图片Web


网页前端技术排行
最近发表
网站分类
标签列表