jquery实现简单实用的轮播器
WEB开发经常实用到一种情况,即某个容器内的各项轮流循环播放显示,同时有相应的导航条提示,因为这个在很多地方可以使用,而且功能很相似的,所以写一个这样的播放功能,共享一下,需要注意的是这个需要jQuery的支持,这个自己网上搜索下载即可,下面总结出来如下,直接看代码,
一、把如下保存为一个独立的文件itemPlayerApp.js:
//attend:thisneedjQuery.jssupport
varitemPlayerApp={
author:'shenzhenNBA',
version:'v1.0',
appMaxNum:0,
playData:'1xplay',
playerID:"",
speed:3000,
appPlay:function(){
varf=this.playData.toLowerCase().split('x');
if(f[1]=='play'){
vari;
try{i=parseInt(f[0]);}catch(e){i=0;}
if(i>=this.appMaxNum){i=0;}
this.appTab(i);
this.playData=(++i)+"xplay";
}
},
appTab:function(tabIndex){
vark,j;
try{k=parseInt(tabIndex);}catch(e){k=0;}
for(j=0;j
二、如何使用:
1.需要使用的web页面中引入jQery文件和本itemPlayerApp.js文件,例如:
2.建立如下格式的HTML文件
1
2
3