$(function() {
nav();
banner();
})
function nav() {
$(".navigationlist .subnavigationlist").each(function() {
if (!$(this).find("li").length) {
$(this).remove();
}
});
// 主导航 - 上拉
$(".navigationlist > li").hover(function() {
$(this).children(".subnavigationlist").stop(true).slidedown(200);
}, function() {
$(this).children(".subnavigationlist").stop(true).slideup(200);
});
// 侧栏导航
$(".leftnav .drop").each(function() {
if (!$(this).find("a").length) {
$(this).remove();
}
});
$(".leftnav dd").hover(function() {
$(this).find(".drop").stop().slidedown(300);
}, function() {
$(this).find(".drop").stop().slideup(300);
});
}
// banner焦点图
function banner() {
if (!$("#banner").length || $("#banner li").length <= 1) { return false; }
$("#banner ul li:gt(0)").css({"display":"none"});
var b = $("#banner"),
me = $("#banner ul"),
tip = $("#banner .tip"),
t, interval = 10000,
speed = 700,
speed2 = 700,
n = 0,
n = me.children("li").length;
wid = b.children("li").width();
step = 200,time = 3000;
if ($("#banner .tip").length) {
var htmltip = "";
for (var i = 0; i < n; i++) {
if (i == 0) {
htmltip += ""+(i+1)+"";
} else {
htmltip += ""+(i+1)+"";
}
}
tip.html(htmltip);
}
var func = function() {
if (n >= n - 1) {
n = 0;
}else if(n < -1){
n = n-1;
}
else {
n++;
}
me.children("li").eq(n).css({
"z-index": 2
}).stop().fadein(speed).siblings("li").css({
"z-index": 1
}).stop().fadeout(speed2);
if ($("#banner .tip").length) {
tip.children("span").eq(n).addclass("cur").siblings("span").removeclass("cur");
}
}
$("#banner").hover(function(){
$("#btn_prev,#btn_next").fadein()
},function(){
$("#btn_prev,#btn_next").fadeout()
})
$dragbln = false;
$("#btn_prev").click(function(){
clearinterval(t);
n -= 2;
func();
t = setinterval(func, time)
});
$("#btn_next").click(function(){
clearinterval(t);
func();
t = setinterval(func, time)
});
tip.children("span").click(function() {
clearinterval(t);
n = $(this).index() - 1;
func();
t = setinterval(func, interval);
})
t = setinterval(func, interval);
}
//教学环境