Team:Macquarie Australia/js/banner
From 2014.igem.org
$(document).ready(function() { //Display slider for Javascript users $('#Slider').css('display', 'block');
//Set height of slider (16/5 ratio) $('#Slider').css('height', ($('body').width() / 3.2));
//Position right/left arrows var BarHeight = $('#Slider').height() - $('#BottomLinks').height(); $('#LeftBar, #RightBar').css('height', BarHeight); $('#LeftArrow, #RightArrow').css('top', (BarHeight-60)/2);
//Repeats for window resize $(window).resize(function() { $('#Slider').css('height', ($('body').width() / 3.2));
var BarHeight = $('#Slider').height() - $('#BottomLinks').height(); $('#LeftBar, #RightBar').css('height', BarHeight); $('#LeftArrow, #RightArrow').css('top', (BarHeight-60)/2); });
var TotalSlides = $('.Slides').length; var CurrentSlide = 0;
$('#RightArrow').click(function() { CurrentSlide = ++CurrentSlide % TotalSlides; changeSlide(CurrentSlide); });
$('#LeftArrow').click(function() { CurrentSlide = (CurrentSlide + TotalSlides - 1) % TotalSlides; changeSlide(CurrentSlide); });
$('.SlideLink').click(function() { var ClickedSlide = $(this).attr('id'); CurrentSlide = parseInt(ClickedSlide.replace('Link', )); changeSlide(CurrentSlide); });
function changeSlide(num){ var SlideID = '#Slide' + num; $('.Slides').css('display', 'none'); $(SlideID).css('display', 'block'); } });