Last active
August 29, 2015 14:14
-
-
Save appikonda/75015c251458457a4d95 to your computer and use it in GitHub Desktop.
assignment5
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> | |
<titl>Assignment #5</titl> | |
</head> | |
<style> | |
.move-me { | |
height: 200px; | |
width: 200px; | |
position: absolute; | |
background-color: #ff0000; | |
left: 10px; | |
} | |
</style> | |
<body> | |
<div class="move-me" onmouseover = "moveIt()" ></div> | |
<script> | |
// Explanation: https://www.youtube.com/watch?v=4y8JHE6UKCo&feature=youtu.be | |
// The red box being displayed below should move 100px to the right each time you hover over it. | |
var incrementValue = 100; | |
var col=document.getElementsByClassName('move-me')[0]; | |
var left_px=col.offsetLeft; | |
function moveIt(){ | |
col.style.left= this.left_px + this.incrementValue; | |
this.incrementValue = this.incrementValue+100; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍