Skip to content

Instantly share code, notes, and snippets.

@casspangell
Created January 3, 2011 22:58
Show Gist options
  • Save casspangell/764128 to your computer and use it in GitHub Desktop.
Save casspangell/764128 to your computer and use it in GitHub Desktop.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="language" content="en" />
<title>Gallery</title>
<!--JQUERY-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<!--LIGHTBOX STUFF-->
<script type="text/javascript" src="http://leandrovieira.com/projects/jquery/lightbox/js/jquery.lightbox-0.4.js"></script>
<link rel="stylesheet" type="text/css" href="http://leandrovieira.com/projects/jquery/lightbox/css/jquery.lightbox-0.4.css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
var photoArr = new Array();
for (i = 1; i <= 5; i++){
photoArr.push("gallery/"+i+".jpg");
}
var xhtml='';
for (var i = 0; i <= photoArr.length-1; i++){
var newImg = new Image();
newImg.src = photoArr[i];
var height = newImg.height;
var width = newImg.width;
alert('The image size is '+width+'*'+height);
xhtml+='<a href="'+photoArr[i]+'"><img src="'+photoArr[i]+'" width="'+width+'"height="'+height+'" alt="" /></a>';
}
$('#photos').html(xhtml);
$('#photos a').lightBox({fixedNavigation:true});
});
</script>
</head>
<body align="center" >
<div id="photos"> </div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment