国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

jquery 實現上下滾動效果示例代碼

2024-05-06 15:50:20
字體:
來源:轉載
供稿:網友
上下滾動的效果,不用說,大家都有看到過,本文為大家介紹下使用jquery實現上下滾動效果,感興趣的朋友可以參考下,希望對大家有所幫助

復制代碼 代碼如下:


<script type="text/javascript" src="script/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(function() {
var page = 1;
var i = 1;
var conheight = $('.con li').height();
var lilen = $('li').length;
var len = Math.ceil( lilen / i );
alert(conheight+ " " + len);
//alert("page:"+page+" i:"+i+" conheight:"+conheight+" lilen:"+lilen+" len:"+len)
$('.next').click(function() {
if( page == len){
alert("已經到底不能再在操作!");
return false;
}
$('.con_list').animate({top:'-=' + conheight},'slow');
page++;
//if( page == len ) {
// $('.con_list').animate({top:0},'slow');
// page = 1;
// }else{
// $('.con_list').animate({top:'-=' + conheight},'slow');
// page++;
//}
});
$('.prev').click(function() {
if(page == 1){
alert("已經到頭不能再進行操作!");
return false;
}
$('.con_list').animate({top:'+=' + conheight},'slow');
page--;
//if( page == 1 ) {
// $('.con_list').animate({top:'-=' + conheight*(len - 1)},'slow');
// page = len;
//}else{
// $('.con_list').animate({top:'+=' + conheight},'slow');
// page--;
//}
});
})
</script>
<style type="text/css">
* {
margin:0;padding:0
}
.prev,.next{
width:100px;height:20px;background:#333;cursor:pointer
}
.con{
width:100px;height:300px;overflow:hidden;position:relative
}
.con_list{
position:relative
}
.con li{
height:100px
}
.one{
background:#F90
}
.two {
background:#69C
}
.three{
background:#633
}
</style>
<body>
<div></div>
<div>
<div>
<ul>
<li>11111111111111111111</li>
<li>22222222222222222222</li>
<li>333333333333333333333</li>
<li>444444444444444444444</li>
<li>5555555555555555555555</li>
<li>6666666666666666666666666</li>
<li>7777777777777777777777777</li>
<li>88888888888888888888</li>
<li>99999999999999999999</li>
<li>10103000000000</li>
</ul>
</div>
</div>
<div></div>
</body>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 加查县| 拉孜县| 新沂市| 纳雍县| 泸溪县| 通江县| 西和县| 博湖县| 紫金县| 阳新县| 遂川县| 永平县| 京山县| 湖口县| 沧州市| 鱼台县| 金寨县| 剑川县| 宁化县| 清丰县| 韶山市| 陇西县| 和龙市| 沁源县| 西丰县| 汽车| 北票市| 普洱| 伽师县| 安西县| 陵川县| 株洲市| 金川县| 德惠市| 铜梁县| 井冈山市| 冷水江市| 汪清县| 澜沧| 丰顺县| 德兴市|