📄 trends.js
字号:
function scrollNews(selector,Entry,time,StartIndex)
{
var _self=this;
this.Selector=selector;
this.Entry=Entry;
this.time = time;
this.i=StartIndex||0;
this.Count=$(this.Selector+" ul li").length;
$(this.Selector+" ul li").hide();//全部隐藏
$(this.Selector+" ul li").eq(this.i).show();//第i个显示
$(this.Selector).bind("mouseenter",function(){
if(_self.sI){clearInterval(_self.sI);}
}).bind("mouseleave",function(){
_self.showIndex(_self.i++);
})
this.sI=setInterval(this.Entry+".showIndex(null)",this.time);
this.GetSelector=function(){return this.Selector;}
this.showIndex=function(index)
{
this.i++;//显示下一个
if(this.sI){clearInterval(this.sI);}
this.sI=setInterval(this.Entry+".showIndex()",this.time);
if (index!=null)
{
this.i=index;
}
if(this.i==this.Count)
this.i=0;
$(this.Selector+" ul li").hide();
$(this.Selector+" ul li").eq(this.i).slideDown();
}
}
/**滚动新闻展示效果
code by CssRain--橘子.
转载请注明:http://www.cssrain.cn
// 参数1:ID
// 参数2:实例化对象的名称(跟var 后的相同)
// 参数3:间隔时间
// 参数4:初始化时,默认哪个先显示
**/
var s=new scrollNews("#trends","s", 3000 , 3);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -