惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
G
Google Developers Blog
Spread Privacy
Spread Privacy
I
InfoQ
V
V2EX
S
Schneier on Security
小众软件
小众软件
C
CERT Recently Published Vulnerability Notes
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Stack Overflow Blog
Stack Overflow Blog
T
Threat Research - Cisco Blogs
L
Lohrmann on Cybersecurity
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Attack and Defense Labs
Attack and Defense Labs
云风的 BLOG
云风的 BLOG
The Hacker News
The Hacker News
S
SegmentFault 最新的问题
C
Cybersecurity and Infrastructure Security Agency CISA
NISL@THU
NISL@THU
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
Latest news
Latest news
S
Secure Thoughts
Project Zero
Project Zero
MongoDB | Blog
MongoDB | Blog
I
Intezer
Security Latest
Security Latest
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
N
Netflix TechBlog - Medium
V2EX - 技术
V2EX - 技术
量子位
T
Threatpost
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
T
Tor Project blog
A
Arctic Wolf
Microsoft Security Blog
Microsoft Security Blog
T
The Exploit Database - CXSecurity.com
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
C
Check Point Blog
博客园 - Franky
Google DeepMind News
Google DeepMind News
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
L
LINUX DO - 热门话题

博客园 - Flymouse

Error CS0006 when invoking MSBuild from command line 一个Cookie引起的混乱 数据库错误:在执行批处理时出现错误。错误消息为: 目录名无效 NorthScale MemBase Server 1.6 的使用 使用网络目录映射虚拟目录出现 500.19 权限不足问题的一个解决办法 URL重写给 asp.net Ajax带来的问题 调整viewState的位置,有助于SEO C# Excel进程关闭 - Flymouse - 博客园 关于限制水晶报表的导出格式 2个Excel异常处理 Win7 x64 IIS7支持32位应用程序 在.net中与mysql数据库的时候碰到显示不了中文字符的情况实现! 完美解决IFRAME中COOKIE、SESSION丢失 关于Ucenter在IIS中有时出现“Access denied for agent changed”错误。 如何將 Access 的 Memo 型態欄位匯入到 SQL2005 的 nvarchar 型態欄位 .net wap强制输出WML - Flymouse - 博客园 使用Extjs的Form无法输入的问题 ASP.NET 2.0 中动态添加 GridView 模板列的例子 关于使用 jquery Validate 使用出现的问题
jQuery滚屏代码,还有一点地方封装不进去 - Flymouse - 博客园
Flymouse · 2008-05-14 · via 博客园 - Flymouse

//滚屏
Scroller=function(config,callback){
    
this.Obj=config.Obj;//滚屏对象
    this.ul=this.Obj.eq(0).find("ul:first");
    
this.lineH=this.ul.find("li:first").height();
    
this.line=config.line?parseInt(config.line,10):parseInt(this.Obj.height()/this.lineH,10);//滚屏行数
    this.speed=config.speed?parseInt(config.speed,10):500;//滚屏速度,越大越慢
    this.timer=config.timer?parseInt(config.timer,10):3000;//滚屏间隔时间
    this.timerID=null;
    
if(this.line==0this.line=1;
    
this.upHeight=0-this.line*this.lineH;
    
this.scrollUp=function(){
        
this.ul.animate({
                marginTop:
this.upHeight
            }
,this.speed,function(){
                
for(var j=1;j<=this.ScrollBox.line;j++){
                    $(
this).find("li:first").appendTo($(this));
                }

                $(
this).css({marginTop:0});
        }
);
        
var SBox=this;
        SBox.timerID
=setTimeout(function(){
            GobalScroll.apply(
this,[SBox]);
        }
,SBox.timer);
    }

    
this.ul[0].ScrollBox=this;
    
this.stop=function(){
        
var ScrollBox=this.ScrollBox;
        clearTimeout(ScrollBox.timerID);
    }

    
    
this.scroll=function(){
        
var ScrollBox=this.ScrollBox;
        ScrollBox.timerID
=setTimeout(function(){
            GobalScroll.apply(
this,[ScrollBox]);
        }
,ScrollBox.timer);
    }

    
    
this.ul.hover(this.stop,this.scroll);
    
var ScrollBox1=this;
    ScrollBox1.timerID
=setTimeout(function(){
        GobalScroll.apply(
this,[ScrollBox1]);
    }
,ScrollBox1.timer);
}


function GobalScroll(obj){
    obj.scrollUp();
}

Css:

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;}

HTML:

<p>多行滚动演示:</p>
<div id="scrollDiv">
  
<ul>
    
<li>这是公告标题的第一行</li>
    
<li>这是公告标题的第二行</li>
    
<li>这是公告标题的第三行</li>
    
<li>这是公告标题的第四行</li>
    
<li>这是公告标题的第五行</li>
    
<li>这是公告标题的第六行</li>
    
<li>这是公告标题的第七行</li>
    
<li>这是公告标题的第八行</li>
    
<li>这是公告标题的第9行</li>
    
<li>这是公告标题的第10行</li>
    
<li>这是公告标题的第9行</li>
    
<li>这是公告标题的第10行</li>
  
</ul>
</div>

调用:

var news=new Scroller({line:1,speed:1000,timer:4000,Obj:$("#scrollDiv")});