Skip to content

Instantly share code, notes, and snippets.

@featherart
Last active December 24, 2015 13:09
Show Gist options
  • Save featherart/6802486 to your computer and use it in GitHub Desktop.
Save featherart/6802486 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Supersize Me Cookie</title>
</head>
<body>
<button href="#" onclick="myStopFunction();">stop the cookie!</button>
<br>
<img name="fred" id="freddie" src="cookie.jpg" width="100" height="auto">
<script type="text/javascript">
window.onload = function() {
var myImage = document.images["fred"];
myImage.height = 100;
myImage.width = 100;
function makeBig() {
//myImage.height = myImage.height + 5;
//myImage.width = myImage.width + 5;
myImage.width *= 1.1;
myImage.height *= 1.1;
}
var myVar=setInterval(function(){ makeBig() },500);
window.myStopFunction = function() {
window.clearInterval(myVar);
}
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment