锘?(function () { //棣栭〉澶у浘杞挱 var $con = $('#gg'), $box = $con.find('#ggBox'), $btns = $con.find('#ggBtns'), i_index = 0, autoChange = function () { i_index += 1; if (i_index === 5) { i_index = 0; } $btns.find('a:eq(' + i_index + ')').addClass('ggOn').siblings().removeClass('ggOn'); var curr = $box.find('a:eq(' + i_index + ')'), prev = curr.siblings(); prev.css('z-index', 2); curr.css('z-index', 3).animate({ 'opacity': 1 }, 150, function () { prev.css({ 'z-index': 1, 'opacity': 0.1 }); }); }, loop = setInterval(autoChange, 4000); $con.hover(function () { clearInterval(loop); }, function () { loop = setInterval(autoChange, 4000); }); $btns.find('a').click(function () { i_index = $(this).index() - 1; autoChange(); }); //棣栭〉鏂伴椈鍔ㄦ€ var isover = true; var boxwidth = parseInt($(".box").css("width")); var boxlength = $(".box_center dl").length; $(".box_center").width(boxlength * boxwidth); $("#hot_left").click(function () { leftgo(); }); $("#hot_right").click(function () { if (isover) { isover = false; var width = parseInt($(".box_center").css("width")); var left = parseInt($(".box_center").css("left")); if (left == 0) { $(".box_center").animate({ left: (boxwidth - width) }, "slow", function () { isover = true; }); } else { $(".box_center").animate({ left: (left + boxwidth) }, "slow", function () { isover = true; }); } } }); function leftgo() { if (isover) { isover = false; var width = parseInt($(".box_center").css("width")); var left = parseInt($(".box_center").css("left")); if ((left + width) == boxwidth) { $(".box_center").animate({ left: 0 }, "slow", function () { isover = true; }); } else { $(".box_center").animate({ left: (left - boxwidth) }, "slow", function () { isover = true; }); } } } //loopbox = setInterval(leftgo, 3000); //$(".hot_news").hover(function () { // clearInterval(loopbox); //}, function () { // setInterval(leftgo, 3000); //}); //棰嗚埅浜 var aboutwidth = 450; $("#about_right").click(function () { if (isover) { isover = false; var width = parseInt($(".about_center").css("width")); var left = parseInt($(".about_center").css("left")); if ((left + width) == aboutwidth) { $(".about_center").animate({ left: 0 }, "slow", function () { isover = true; }); } else { $(".about_center").animate({ left: (left - aboutwidth) }, "slow", function () { isover = true; }); } } }); $("#about_left").click(function () { if (isover) { isover = false; var width = parseInt($(".about_center").css("width")); var left = parseInt($(".about_center").css("left")); if (left == 0) { $(".about_center").animate({ left: (aboutwidth - width) }, "slow", function () { isover = true; }); } else { $(".about_center").animate({ left: (left + aboutwidth) }, "slow", function () { isover = true; }); } } }); //棣栭〉鎺ㄨ崘浜у搧 $("#menu2 li").mousemove(function () { $("#menu2 li").removeClass("menuOn"); $(this).addClass("menuOn"); $(".pro_list").addClass("dn").removeClass("now"); $(".pro_list").eq($(this).index()).removeClass("dn").addClass("now"); }); var pro_list = $("ul.pro_list"); var prowidth = 160; var prolength = 0; for (var i = 0; i < pro_list.length; i++) { prolength = $(pro_list[i]).find("li").length; $(pro_list[i]).width(prolength * prowidth); } $("#pro_right").click(function () { var width = parseInt($(".now").css("width")); var left = parseInt($(".now").css("left")); if (isover && width > 800) { isover = false; if ((left + width) == 800) { $(".now").animate({ left: 0 }, "slow", function () { isover = true; }); } else { $(".now").animate({ left: (left - prowidth) }, "slow", function () { isover = true; }); } } }); $("#pro_left").click(function () { var width = parseInt($(".now").css("width")); var left = parseInt($(".now").css("left")); if (isover && width > 800) { isover = false; if (left == 0) { $(".now").animate({ left: (800 - width) }, "slow", function () { isover = true; }); } else { $(".now").animate({ left: (left + prowidth) }, "slow", function () { isover = true; }); } } }); });