script

$(function(){

//导航栏事件
navAction();
//滚动
doScroll();

});
function navAction(){

var navs = $("#nav ul li");
navs.click(function(){
     $("#nav ul li").removeClass("select");
     $(this).addClass("select");
}).eq(0).click();

}

//滚动
function doScroll(){
//滚动的数字
var scroll_nums = (“#show_scroll .num li”);  
    //滚动的大图  
    var scroll_sliders =
(“#show_scroll .slider li”);
//长度
var len = $(“#show_scroll .num li”).length;
var index = 0;
var timer;
//数字鼠标悬浮时间
scroll_nums.mouseover(function(){
index = scroll_nums.index(this);
showImg(index);
}).eq(0).mouseover();
//定时滚动
timer = setInterval(function(){
showImg(index);
index++;
if(index==len){
index = 0;
}
}, 3000);

scroll_sliders.hover(function(){
    clearInterval(timer);
},function(){
    timer = setInterval(function(){
        showImg(index);
        index++;
        if(index==len){
            index = 0;
        }
    }, 3000);
});

}

function showImg(index){
var scrollHeight = (“#show_scroll”).width();  
    var total = scrollHeight*index;
(“#show_scroll .slider”).stop(true, false).animate({“left”:-total+”px”}, 1000);
$(“#show_scroll .num li”).removeClass(“on”)
.eq(index).addClass(“on”);
}

你可能感兴趣的:(script)