// 例如淡入淡出的封装类文件
function ImagesEff(div,time){
this.arr=[];//装载所有div
this.time=time;
this.recordOld=null;
for(var i=0;i<document.getElementById(div).getElementsByTagName("div").length;i++){
this.arr.push(document.getElementById(div).getElementsByTagName("div")[i]);
this.arr[i].style.position="absolute";
//this.arr[i].style.opacity=0;//除IE8外都行
//this.arr[i].style.filter="alpha(opacity=0)";//除IE8外都行
var _id="#"+this.arr[i].id;//为了下面这句得把变量赋值过来
$(_id).hide();//兼容IE8请这样写,否则根本不隐藏
}
}
ImagesEff.prototype.showImage=function(id){//淡入淡出
var _id="#"+this.arr[id].id;
//$(_id).animate({opacity:1}, this.time);
$(_id).fadeIn();//兼容IE8请这样写,否则会有错误,比如淡入2次后失灵
if(this.recordOld!=null){
var oldId="#"+this.recordOld.id;
//$(oldId).animate({opacity:0}, this.time);
$(oldId).fadeOut();
}
this.recordOld=this.arr[id];
}