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.
|
|
|
|
/*Picture Left Roller*/
|
|
|
|
|
$(function() {
|
|
|
|
|
function LeftRoller(){
|
|
|
|
|
var Lis = $("#LeftRoller #LeftRollerRoll>ul>li");
|
|
|
|
|
var sWidth = Lis.eq(0).outerWidth(true); //图片宽度
|
|
|
|
|
var sHeight = Lis.eq(0).outerHeight(true); //图片宽度
|
|
|
|
|
var len = Lis.length; //播放数量
|
|
|
|
|
var index = 0; //当前在首页索引
|
|
|
|
|
var picTimer; //播放对像
|
|
|
|
|
//显示图片
|
|
|
|
|
var WinWidth = $("#LeftRoller").width();
|
|
|
|
|
for(var j=0;j<len;j++){
|
|
|
|
|
var wtmp = j * sWidth;
|
|
|
|
|
if(wtmp > $("#LeftRoller").width()){break;}
|
|
|
|
|
WinWidth = wtmp;
|
|
|
|
|
}
|
|
|
|
|
$("#LeftRoller #LeftRollerRoll").width(sWidth * len * 2).height(sHeight).css('position','relative');
|
|
|
|
|
$("#LeftRoller #LeftRollerWin").width(WinWidth).height(sHeight).css('overflow','hidden');
|
|
|
|
|
Lis.clone().appendTo("#LeftRoller #LeftRollerRoll>ul"); //重复一次
|
|
|
|
|
showPics(index);
|
|
|
|
|
//鼠标滑上焦点图时停止自动播放,滑出时开始自动播放
|
|
|
|
|
$("#LeftRoller #LeftRollerWin").hover(function() {
|
|
|
|
|
clearInterval(picTimer);
|
|
|
|
|
},function() {
|
|
|
|
|
picTimer = setInterval(function() {
|
|
|
|
|
showPics(index);
|
|
|
|
|
},4000); //此4000代表自动播放的间隔,单位:毫秒
|
|
|
|
|
}).trigger("mouseleave");
|
|
|
|
|
|
|
|
|
|
$('#LeftRoller>div:eq(1)>a').bind('click',function(){
|
|
|
|
|
index = $(this).index();
|
|
|
|
|
showPics(index);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function cReset(){
|
|
|
|
|
if(index == len) {index = 0;$("#LeftRoller #LeftRollerRoll").delay(1000).css({left:0});}
|
|
|
|
|
$('#LeftRoller>div:eq(1)>a').removeClass('current').eq(index).addClass('current');
|
|
|
|
|
index++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function showPics(index) { //普通切换
|
|
|
|
|
var nowLeft = -index*sWidth;
|
|
|
|
|
//移动效果
|
|
|
|
|
$("#LeftRoller #LeftRollerRoll").animate({left:nowLeft}, 1000 ,cReset);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(typeof LeftRoller == 'function'){
|
|
|
|
|
LeftRoller();
|
|
|
|
|
}
|
|
|
|
|
});
|