You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
852 B

$(function () {
var $con = $('#gg'), $box = $con.find('#ggBox'), $btns = $con.find('#ggBtns'), i = 0, autoChange = function () {
i += 1;
if (i === 5) { i = 0; }
$btns.find('a:eq(' + i + ')').addClass('ggOn').siblings().removeClass('ggOn');
var curr = $box.find('a:eq(' + i + ')'), 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, 5000);
$con.hover(function () {
clearInterval(loop);
}, function () {
loop = setInterval(autoChange, 5000);
});
$btns.find('a').click(function () {
i = $(this).index() - 1;
autoChange();
});
});