简单的翻页组件
来源:互联网 发布:淘宝优惠券领券链接 编辑:程序博客网 时间:2024/05/21 06:57
page_div=function(_pageJson){
this.top=_pageJson.top || 0;
this.pageHeight=_pageJson.pageHeight;
this.pageJson=_pageJson;
this.isLoop=_pageJson.isLoop || false;
this.handle=_pageJson.handle || function(){};
}
page_div.prototype={
init: function( _curPage,totalPage){
this.div=document.getElementById(this.pageJson.divId);
this.lineHeight=(this.pageJson.lineHeight==undefined? this.div.style.lineHeight:(this.div.style.lineHeight=_pageJson.lineHeight));
this.lineSize=this.pageJson.lineSize || Math.ceil(this.pageHeight/this.lineHeight);
this.x=(this.pageJson.x==undefined? this.div.style.left:(this.div.style.left=_pageJson.x));
this.y=(this.pageJson.y==undefined? this.div.style.top:(this.div.style.top=_pageJson.y));
this.w=(this.pageJson.w==undefined? this.div.offsetHeight:(this.div.offsetHeight=_pageJson.w));
this.h=(this.pageJson.h==undefined? this.div.offsetHeight:(this.div.offsetHeight=_pageJson.h));
this.currPage = _curPage;
if(this.pageHeight==undefined){
this.pageHeight=this.lineHeight*this.lineSize;
}
this.totalPage=Math.ceil(this.h/this.pageHeight);
if(this.totalPage <=0)this.totalPage=1;
this.div.offsetTop+=this.pageHeight*(_curPage-1);
if(totalPage!=undefined)this.totalPage=totalPage;
},
turnPage:function(type){
this.currPage+=type;
if(this.isLoop){
if(this.currPage>this.totalPage)this.currPage=1;
else
if(this.currPage<1)this.currPage=this.totalPage;
}else{
if(this.currPage>this.totalPage)this.currPage=this.totalPage;
else
if(this.currPage<1)this.currPage=1;
}
this.div.style.top=(this.top-this.pageHeight*(this.currPage-1))+"px";
this.handle();
}
}
this.top=_pageJson.top || 0;
this.pageHeight=_pageJson.pageHeight;
this.pageJson=_pageJson;
this.isLoop=_pageJson.isLoop || false;
this.handle=_pageJson.handle || function(){};
}
page_div.prototype={
init: function( _curPage,totalPage){
this.div=document.getElementById(this.pageJson.divId);
this.lineHeight=(this.pageJson.lineHeight==undefined? this.div.style.lineHeight:(this.div.style.lineHeight=_pageJson.lineHeight));
this.lineSize=this.pageJson.lineSize || Math.ceil(this.pageHeight/this.lineHeight);
this.x=(this.pageJson.x==undefined? this.div.style.left:(this.div.style.left=_pageJson.x));
this.y=(this.pageJson.y==undefined? this.div.style.top:(this.div.style.top=_pageJson.y));
this.w=(this.pageJson.w==undefined? this.div.offsetHeight:(this.div.offsetHeight=_pageJson.w));
this.h=(this.pageJson.h==undefined? this.div.offsetHeight:(this.div.offsetHeight=_pageJson.h));
this.currPage = _curPage;
if(this.pageHeight==undefined){
this.pageHeight=this.lineHeight*this.lineSize;
}
this.totalPage=Math.ceil(this.h/this.pageHeight);
if(this.totalPage <=0)this.totalPage=1;
this.div.offsetTop+=this.pageHeight*(_curPage-1);
if(totalPage!=undefined)this.totalPage=totalPage;
},
turnPage:function(type){
this.currPage+=type;
if(this.isLoop){
if(this.currPage>this.totalPage)this.currPage=1;
else
if(this.currPage<1)this.currPage=this.totalPage;
}else{
if(this.currPage>this.totalPage)this.currPage=this.totalPage;
else
if(this.currPage<1)this.currPage=1;
}
this.div.style.top=(this.top-this.pageHeight*(this.currPage-1))+"px";
this.handle();
}
}
0 0
- 简单的翻页组件
- 一个简单的翻页代码
- 编写简单的翻页效果
- 图片的简单特效翻页
- ICallbackEventHandler实现的无刷新翻页组件
- 基于vueJs框架的翻页组件
- iphone中编写简单的翻页效果
- android中简单的图片翻页效果
- iOS-编写简单的翻页效果
- 最简单的左右滑动翻页案例
- 一个简单jsp的翻页控制
- android最简单的ViewPager无限翻页
- IOS 实现控制器翻页的简单解决方法
- 用Opencv实现简单的图片翻页
- QML 实现简单的翻页功能
- js 翻页组件 pagination
- Struts2 实现翻页组件
- vue2.0翻页组件
- 浅谈三层
- 基础篇——序列化和文件的输入输出
- hdu2043 密码
- AFNetwork作用和用法详解
- 杭电1016————素数环之DFS
- 简单的翻页组件
- 使用Apache FtpServer搭建FTP服务器
- XML简介(章节摘要)
- 计数器模块
- 关于远程界面变全屏与远程服务器数据拷贝到本地的解决方案
- Android开源框架ImageLoader的完美例子
- Vi编辑器的使用方法
- julia: 如何序列化和反序列化?
- Redis安装