DY_scroll('#main_bar',5,true,ad01,0,"#bar_icon");// true为自动播放,不加此参数或false就默认不自动
var ad,ad01,ad02,ad03;
function DY_scroll(wraper,speed,or,ad,curpic,picbottom){
var wraper = $(wraper);
var piccount = wraper.find("ul li").size();
for(i=0;i<piccount;i++){
$(picbottom).find("ul").append("<li><img src='pimage/bar_icon2.png'/></li>");
}
var img = wraper.find('ul');
var w = img.find('li').outerWidth(true);
var picbottom = $(picbottom).find("img");
var s = speed;
picbottom.eq(curpic).attr("src","pimage/bar_icon1.png");
function next(){
if(!img.is(':animated')){
img.animate({'margin-left':-w},function(){
img.find('li').eq(0).appendTo(img);
img.css({'margin-left':0});
});
curpic = curpic+1;
if(curpic==piccount){
curpic = 0;
}
for(i=0;i<piccount;i++){
if(curpic==i){
picbottom.eq(i).attr("src","pimage/bar_icon1.png");
}else{
picbottom.eq(i).attr("src","pimage/bar_icon2.png");
}
}
}
}
if (or == true)
{
ad = setInterval(function() { next();},s*1000);
wraper.hover(function(){clearInterval(ad);},function(){ad = setInterval(function() { next();},s*1000);});
}
}
//合作伙伴轮播
var $media = $("#four_con ul");
var Top=-$("#four_con ul li").height();//定义一个向上移动的距离,这个数值和你图片或DIV的高度相等
var count = $("#four_con ul li").size();
if(count%5==0){
count = Math.floor(count/5);
}else{
count = Math.floor(count/5+1);
}
var totalheight = Top*(count);
var Time=500;//定义一个速度
function move(){
$media.animate({"margin-top":Top},Time);//animate方法,只能对数值型的值进行渐变
Top+=-$("#four_con").height();//运行一次增加一个图片的高度
if(Top==totalheight)//判断当总高度大于你DIV或者图片总高度
{
Top=0;//把距离设置回0
Time=200;//加快移动速度
}
else
{
Time=500;//否则减慢速度
}
}
setInterval(move,3000);//3秒执行一次move()