Created
November 1, 2010 22:18
-
-
Save donaldr/658976 to your computer and use it in GitHub Desktop.
Added image replacing sauce.
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> | |
<html> | |
<head> | |
<title>info</title> | |
<LINK REL=StyleSheet HREF="style.css" TYPE="text/css"> | |
<script type="text/javascript" src="jquery.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
function replaceImage(callback) | |
{ | |
//Ok here are the two ways that you can go about doing this. If you | |
//dom an easy way might be to place the image and rely on the load event. | |
//Create the image using the W3G createElement function. | |
var img = document.createElement('IMG'); | |
//Set the source appropriately | |
img.src = "/image/myimage.jpg"; | |
//You'll need to place the image somewhere in order for it to load. | |
//You'll also want to make sure it doesn't show up on the screen. | |
img = $(img); | |
img.css('position', 'absolute'); | |
img.css('width', '0'); | |
img.css('height', '0'); | |
//Before we append it we have to make sure we add the event | |
img.load(function() { | |
img.remove(); | |
img.css('position', null); | |
img.css('width', null); | |
img.css('height', null); | |
//Now your callback has access to the image. It should place it appropriately. | |
callback(img); | |
}); | |
//Now when we append the image it should load. Remember in your callback | |
body.append(img); | |
} | |
var setImage = function(source) | |
{ | |
$(".imgimg").attr("src", source); | |
} | |
var setInfo=function(info) | |
{ | |
$("#description").html(info); | |
} | |
setInfo("<p>The organizational scheme for Thomas Jefferson\u2019s library\u2014the foundation of the Library of Congress\u2014forms the interactive met | |
window.setImage = setImage; | |
window.setInfo = setInfo; | |
}); | |
</script> | |
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> | |
</head> | |
<body> | |
<div class="infotop"> | |
<div id="image" class="imgdiv"> | |
<img class="imgimg" src="../images/4699_image.jpg"/> | |
</div> | |
<div id="description" class="desc"> | |
<p> | |
This digital painting tablet presents an interactive palette of technicolor | |
shapes and converts young visitors into collaborative, avant-garde artists. | |
</p> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment