Created
November 29, 2011 10:23
-
-
Save meeDamian/1404319 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main_rotator_init() { | |
clearInterval(interval); | |
interval = setInterval("main_rotator()",5000); | |
} | |
function main_rotator() { | |
$node = $('.current'); | |
$node.hide(); | |
$('.main').removeClass('current'); | |
if($node.next().length) $node.next().addClass('current'); | |
else $('.main:first').addClass('current'); | |
$node = $('.selected'); | |
$('.bullet').removeClass('selected'); | |
if($node.next().length) $node.next().addClass('selected'); | |
else $('.bullet:first').addClass('selected'); | |
top.location.href = $('.selected a').attr('href'); | |
} | |
function main_controller(interval) { | |
$('.bullet a').click(function(){ | |
clearInterval(interval); | |
clearTimeout(timeout); | |
var clicked = $(this).attr('href'); | |
top.location.href = clicked; | |
$('.main').removeClass('current'); | |
$('.bullet').removeClass('selected'); | |
$(this).parent().addClass('selected'); | |
$(clicked).addClass('current'); | |
timeout = setTimeout('main_rotator_init()',6000); | |
return false; | |
}); | |
} | |
var interval, timeout; | |
$(function(){ | |
main_rotator_init(); | |
main_controller(interval); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment