Incorporated into my HTML file is a concise script:
$(document).ready(function() {
var rand = Math.floor((Math.random()*3)+1) //generates random number between 1 and 3
$("body").css({ "background": "url(image" + rand + ".jpg)",
"background-size": "100% 100%",
"background-repeat": "no-repeat"
});
});
The concept behind this script is to randomly display one of three images (image1.jpg, image2.jpg, or image3.jpg) hosted on the server when the page loads.
Is there a more effective approach for achieving this?
PS - This situation bears similarities to the GitHub Notifications page. After viewing all notifications, each time you refresh the page, a new version of the octocat appears to welcome you :)