Created
September 8, 2013 04:51
-
-
Save shahariaazam/6481938 to your computer and use it in GitHub Desktop.
Javascript code snippets to practice for novice
Topic: Infinite Height in JS
This file contains 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
<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