最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jquery 上下滾動廣告

 更新時間:2009年06月17日 22:32:37   作者:  
jquery 上下滾動廣告實現(xiàn)代碼,大家可以自行測試,需要加載jquery類庫
復(fù)制代碼 代碼如下:

(function($){
$.fn.extend({
rollList:function(option){
option=$.extend({
direction:"up",
step:1,
time:23
},option);
var step_coe,scroll_coe,score_coe;
if(option.direction=="up")
{
step_coe=1;
scroll_coe=1;
score_coe=1;
}else
{
step_coe=-1;
scroll_coe=-1;
score_coe=0;
}
return this.each(function(){
var $this=$(this);
var _this=this;
var itemHeight;
var temp=$("<DIV> </DIV>");
$this.css("overflow","hidden").children()
.appendTo(temp);
$this.append(temp.clone(true)).append(temp);
itemHeight=$this.children();
itemHeight=itemHeight.eq(1).offset().top-itemHeight.eq(0).offset().top;
while($this.children(":last").offset().top-$this.offset().top<=$this.height())
$this.append(temp.clone(true));
var roll;
this.scrollTop=itemHeight*(1-score_coe);
roll=function (){
temp=setInterval(function(){
if(_this.scrollTop*scroll_coe>=itemHeight*score_coe)
{
_this.scrollTop=(_this.scrollTop-itemHeight)*scroll_coe;
}
_this.scrollTop+=option.step*step_coe;

},option.time);
}
$this.hover(function(){
clearInterval(temp);
},function(){
roll();
});
roll();
});
}
})
}(jQuery));

調(diào)用如下:
復(fù)制代碼 代碼如下:

$(elem).rollList();

相關(guān)文章

最新評論

翁牛特旗| 南宫市| 顺平县| 青川县| 南平市| 阳春市| 广南县| 嘉黎县| 望谟县| 禹州市| 南靖县| 西乌珠穆沁旗| 洪湖市| 晋州市| 霸州市| 思南县| 巴塘县| 岑溪市| 凉城县| 明光市| 永顺县| 许昌市| 潜江市| 平武县| 平陆县| 马公市| 建阳市| 香港 | 芜湖县| 赞皇县| 页游| 定兴县| 长治市| 吴堡县| 凤庆县| 常德市| 万全县| 秀山| 文登市| 景东| 定安县|