jQuery实现列表内容的动态载入特效

jQuery实现列表内容的动态载入特效,第1张

采用Jquery实现的列表数据动态更新效果,更新的数据可以是ajax请求的数据。
CSS:
main
{
width:
100%;
margin-top:
100px;
text-align:
center;
font-size:
125px;
}
th,
td
{
border:
1px
solid
#ccc;
line-height:
40px;
padding-left:
5px;
}
item:hover
{
background-color:
#efefef;
}
item:nth-child(2n)
{
background-color:
#efefef;
}
ListView
{
width:
600px;
overflow:
hidden;
margin:
0
auto;
padding:
10px;
height:372px;
border:
1px
solid
#dddddd;
}
ListView
c
{
width:
1200px;
margin:
0
auto;
border-collapse:
collapse;
}
Item
{
border-bottom:
1px
dashed
#dddddd;
padding:
10px
0
10px
0;
overflow:
hidden;
margin-left:600px;
}
Item
span
{
float:
left;
text-align:
left;
}
Item
span:first-child
{
color:
#6AA8E8;
}
Item
span:last-child
{
text-align:
center;
}
HTML
<div
class="main">
<div
class="ListView">
<div
class="c">
<div
class="Item">
<span>test</span>
<span>男/0</span>
<span>四川省,成都市锦江区</span>
<span>详细说明</span>
</div>
<div
class="Item">
<span>test</span>
<span>男/0</span>
<span>四川省,成都市,锦江区</span>
<span>详细说明</span>
</div>
<div
class="Item">
<span>test</span>
<span>男/0</span>
<span>四川省,成都市,锦江区</span>
<span>详细说明</span>
</div>
<div
class="Item">
<span>test</span>
<span>男/0</span>
<span>四川省,成都市,锦江区</span>
<span>详细说明</span>
</div>
<div
class="Item">
<span>test</span>
<span>男/0</span>
<span>四川省,成都市,锦江区</span>
<span>详细说明</span>
</div>
<div
class="Item">
<span>test</span>
<span>男/0</span>
<span>四川省,成都市,锦江区</span>
<span>详细说明</span>
</div>
<div
class="Item">
<span>test</span>
<span>男/0</span>
<span>四川省,成都市,锦江区</span>
<span>详细说明</span>
</div>
<div
class="Item">
<span>test</span>
<span>男/0</span>
<span>四川省,成都市,锦江区</span>
<span>详细说明</span>
</div>
<div
class="Item">
<span>test</span>
<span>男/0</span>
<span>四川省,成都市,锦江区</span>
<span>详细说明</span>
</div>
<div
class="Item">
<span>test</span>
<span>男/0</span>
<span>四川省,成都市,锦江区</span>
<span>详细说明</span>
</div>
</div>
</div>
</div>
<p
style="text-align:center;"><a
href="javascript:void(0);"
onClick="ListViewUpdate();">刷新数据</a></p>
JS
<script
type="text/javascript"
src="/js/jquery-180minjs"></script>
<script
type="text/javascript">
$(function(){
ListViewInit();
});
var
ListView={
Init:function(){
$("Item
span")css("width",$("ListView")width()/4+"px");
for(var
i=0;i<$("Item")length;i++){
var
target=$("Item")[i];
$(target)animate({marginLeft:"0px"},300+i100);
}
},
Update:function(){
$("ListView
c
Item")remove();
for(var
i=0;i<10;i++){
var
newItem=$("<div
class=\"Item\">
<span>test</span>
<span>男/"+i+"</span>
<span>四川省,成都市,锦江区</span>
<span>详细说明</span>
</div>");
$(newItem)find("span")css("width",$("ListView")width()/4+"px");
$("ListView
c")append(newItem);
$(newItem)animate({marginLeft:"0px"},300+i100);
}
}
}
</script>
附上演示效果
>高度是自适应的吧 ,你这样改有啥意思?
强要改,在这:
html+='<div class="cell"><img src="'+src+'" /><p>'+k+'</p></div>';
改为
html+'<div class="cell"><img src="'+src+'" height="高度" /><p>'+k+'</p></div>';

<!DOCTYPE html>
<html>
<head>
    <meta >sum=lirun01;
}else if (lirun<=200000){
sum=10000+lirun0075;
}else if (lirun<=400000){
sum=17500+lirun005;
}else if (lirun<=600000){
sum=lirun003;
}else if (lirun<=1000000){
sum=lirun0015;
} else{
sum=lirun001;
}

itemSelector class选择器,默认'item',这个表示每个块的选择器
columnWidth 一列的宽度
isAnimated 使用jquery的布局变化,默认true
animationOptions animate属性渐变效果(Object { queue: false, duration: 500 })
gutterWidth 列的间隙 Integer
isFitWidth 自适应浏览器宽度Boolean
isResizableL 是否可调整大小 Boolean
isRTL 使用从右到左的布局 Boolean


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/13399331.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-07-29
下一篇 2023-07-29

发表评论

登录后才能评论

评论列表(0条)

保存