欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery 頁(yè)眉單行信息滾動(dòng)顯示實(shí)現(xiàn)思路及代碼

 更新時(shí)間:2014年06月26日 10:07:14   投稿:whsnow  
將滾動(dòng)的內(nèi)容查詢出來(lái),放在一個(gè)div 或者別的容器里面,具體的實(shí)現(xiàn)代碼如下

以下是控制滾動(dòng)的樣式,將滾動(dòng)的內(nèi)容查詢出來(lái),放在一個(gè)div 或者別的容器里面,我這里使用的是<dt>

<style>
#newCglist{width:300px;height:14px;line-height:14px;overflow:hidden}
#newCglist li{height:14px;padding-left:10px;}
</style>

以下是滾動(dòng)內(nèi)容展示的容器

<dt class="positionrel" id="newCglist" ><div class="new positionabs"></div></dt>

以下是js,查詢滾動(dòng)展示內(nèi)容

var divhight ; //這是所有數(shù)據(jù)行的高度,每行行高*數(shù)據(jù)量
var showtimes ; //顯示完所有數(shù)據(jù)的時(shí)間,每行顯示所需的時(shí)間*數(shù)據(jù)量
function yejis(){
setInterval('AutoScroll("#newCglist")',500);
//最新成交案例展示
$.post("zrAction!newCgList.action",null,function(data){
divhight = data.length*14;
showtimes = data.length*3000;
$.each(data,function(i,datas){
$ul = $("<ul></ul>");
$tr = $("<li>"+datas[0]+" 簽單成功!&nbsp;"+datas[1]+"元&nbsp;"+datas[2]+"&nbsp;"+datas[3]+"</li>");
$ul.append($tr);
$("#newCglist").append($ul);
});
});

以下是控制滾動(dòng)展示時(shí)間,以及樣式

/**
* 首頁(yè)頂部滾動(dòng)效果,divhight 是所有數(shù)據(jù)的行高
* showtimes //循環(huán)滾動(dòng)完這些數(shù)據(jù)所需的時(shí)間
* @param {Object} obj
* @memberOf {TypeName} 
*/
function AutoScroll(obj){
$(obj).find("ul:first").animate({
marginTop:-divhight
},showtimes,function(){
$(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
});
}

相關(guān)文章

最新評(píng)論