基于jQueryUI的图片预览插件

运用于特定项目环境。暂未改成普遍使用。

var imgGallary=function(){
var imgList=new Array();
var imgId=new Array();
var imgInfo=new Array();
this.push=function(id,element){
imgList.push(element);
imgId.push(id);
imgInfo.push(0);
};
this.preview=function(id){
var index=$.inArray(id,imgId);
if(index!=-1){
if(imgInfo[index]!=1){
for(var i=0;i<imgInfo.length;i++){
if(imgInfo[i]==1){
imgInfo[i]=0;
imgList[i].css("display","none");
}
}
imgInfo[index]=1;
imgList[index].css("display","block");
}
}
};
this.next=function(){
var index=$.inArray(1,imgInfo);
if(index<(imgInfo.length/2-1)){
imgInfo[index]=0;
imgList[index].css("display","none");

imgInfo[index+1]=1;
imgList[index+1].css("display","block");
}
};
this.previous=function(){
var index=$.inArray(1,imgInfo);
if(index>0){
imgInfo[index]=0;
imgList[index].css("display","none");

imgInfo[index-1]=1;
imgList[index-1].css("display","block");
}
};
};

var imgGal=new imgGallary();
$(function(){
$("#previewDialog").dialog({
title:"Image Preview",
autoOpen:false,
modal:true,
width:520,
height:520,
buttons:[
{
text:"OK",
click:function(){
$("#previewDialog").dialog("close");
}
},
{
text:"Next",
click:function(){
imgGal.next();
}
},
{
text:"Previous",
click:function(){
imgGal.previous();
}
}
]
});
});
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值