Skip to content

Instantly share code, notes, and snippets.

@shahariaazam
Created September 8, 2013 04:51
Show Gist options
  • Save shahariaazam/6481938 to your computer and use it in GitHub Desktop.
Save shahariaazam/6481938 to your computer and use it in GitHub Desktop.
Javascript code snippets to practice for novice Topic: Infinite Height in JS
<html>
<head>
<title>Infinite Height</title>
<meta charset="UTF-8">
</head>
<body>
<div id="bar" style="background-color: red; width: 100px; height:50px;"></div>
</body>
<script>
var getHeight = function increaseBarHeight ()
{
var barElement = document.getElementById('bar');
var presentHeight = barElement.style.height;
var nextHeight = parseInt(presentHeight)+20;
barElement.style.height = nextHeight + 'px';
}
setInterval(getHeight, 1000);
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment