Skip to content

Instantly share code, notes, and snippets.

@ryanneufeld
Created November 29, 2012 22:31
Show Gist options
  • Save ryanneufeld/4172346 to your computer and use it in GitHub Desktop.
Save ryanneufeld/4172346 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
/*Here 200 is your divs (check) hight replace it with your required hight alos make required changes at style.*/
$("#body").css('margin-top', winH/2 - 469/2);
/*Here 300 is your divs (check) width replace it with your required width alos make required changes at style.*/
$("#body").css('margin-left', winW/2 - 990/2);
//Definimos los backgrounds
changeBackground();
//setInterval(changeBackground,5000);
blink_uno();
//Solucionamos k cuando hagan click en el li haga el link
$("#header li").click(function(){
var $this = $(this);
$this.find("a").click();
return false;
});
});
function blink_uno() {
document.getElementById('blink').style.visibility='visible';
setTimeout('blink_dos()',500);
}
function blink_dos() {
document.getElementById('blink').style.visibility='hidden';
setTimeout('blink_uno()',500);
}
function changeBackground(){
var randBack = Math.floor((Math.random()*3)+1); ;
var img = 'img/slide'+randBack+'.jpg';
$("body").css({background: 'url("'+img+'") no-repeat center center fixed'});
$("body").css({'background-size': 'cover'});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment