You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
2.9 KiB
JavaScript

// JavaScript Document
///
///positionE:显示对象位置id dealytime停留时间sidetime替换需要的时间defEnum:第几个显示,默认第一个显示,FedaListE["a","b","c"] 形式 参加切换对象id
///
function LoopSideListE(positionE,dealytime,sidetime,defEnum,FedaListE)
{
if (typeof positionE !="string")return;
if (typeof FedaListE !="object")return;
if (typeof dealytime !="number")return;
if (typeof sidetime !="number")return;
if (typeof defEnum !="number")defEnum=1;
$(function(){
var etop,fedinE=[],dealsE2,tp,tl,tmpEi=0,timesign,pevnum=0;
for(i=0;i<FedaListE.length;i++)
{
fedinE[i]=$("#"+FedaListE[i]);
}
var te = $("#"+positionE),ps = te.position();
tp = (te.height()+ 5 + ps.top) + "px";
tl = ps.left +"px";
etop= ps.top;//te.height()* 2
fedinE[defEnum].css({
position: "absolute",
top: ps.top,
left: tl,
display: "block",
"z-index":1000+i
}).hover(function(){
if(timesign)
{
clearTimeout(timesign);
}
// else
// {
$(fedinE[pevnum]).stop();
$(fedinE[tmpEi]).stop();
//}
},function(){
$(fedinE[tmpEi]).animate({top: '+'+etop+'px'}, sidetime,function(){timesign=setTimeout(function(){timespan()},dealytime);});
fedinE[pevnum].animate({top: '-'+(fedinE[tmpEi].height())+'px'}, sidetime);
});
for(i=0;i<fedinE.length;i++)
{
if(i==defEnum)continue;
fedinE[i].css({
position: "absolute",
top: tp,
left: tl,
display: "block",
"z-index":1000+i
}).hover(function(){
if(timesign)
{
clearTimeout(timesign);
}
//else
// {
$(fedinE[pevnum]).stop();
$(fedinE[tmpEi]).stop();
// }
},function(){
$(fedinE[tmpEi]).animate({top: '+'+etop+'px'}, sidetime,function(){timesign=setTimeout(function(){timespan()},dealytime);});
fedinE[pevnum].animate({top: '-'+(fedinE[tmpEi].height())+'px'}, sidetime);
});
}
function FedinHandler(){
fedinE[tmpEi].css({
top: tp,
left: tl
}).animate({top: '+'+etop+'px'}, sidetime,function(){timesign=setTimeout(function(){timespan()},dealytime);});
}
function timespan()
{
fedinE[tmpEi].animate({top: '-'+(fedinE[tmpEi].height())+'px'}, sidetime);
pevnum = tmpEi;
tmpEi++;
if (tmpEi > fedinE.length-1)
{tmpEi =0;}
FedinHandler();
}
timesign=setTimeout(function(){
fedinE[defEnum].animate({top: '-'+(fedinE[defEnum].height())+'px'}, sidetime);
FedinHandler();},dealytime);
});
}