当前位置: 代码迷 >> Web前端 >> 幻灯片成效
  详细解决方案

幻灯片成效

热度:109   发布时间:2012-09-25 09:55:59.0
幻灯片效果


var index = 1;
var timer;
var picSize = 1;
function showPic(){
 for(var i = 1; i < picSize; i++){
  var pid = '#pic_gg_' + i;
  var id = '#gg_' + i;
  if(i == index){
   $(pid).css({'display':'block'});
   $(id).addClass('dq');
  }else{
   $(pid).css({'display':'none'});
   $(id).removeClass('dq');
  }
 }
 index = index == (picSize-1) ? 1 : index + 1;
}
function stop(i){
 clearInterval(timer);
 index=i;
 showPic();
 //setTimeout(start,6000);
}
function start(){
 clearInterval(timer);
 timer = setInterval(showPic,3000);
}
window.onload = function(){
 picSize = 7;
 timer = setInterval(showPic,3000);}

  相关解决方案