Created
April 1, 2017 10:57
-
-
Save akakiev/f977f328a46465d005d45d39b174a994 to your computer and use it in GitHub Desktop.
Hello world's move
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>Coder</title> | |
</head> | |
<body class="page"> | |
<div class="pagecontent"> | |
<h1 id="box">Hello World</h1> | |
<p>My html goes here.</p> | |
<p>It is my first web-page.</p> | |
</div> | |
</body> | |
</html> |
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
window.onload = function() { | |
//This code will run after your page loads | |
var pos=0; | |
var box=document.getElementById('box'); | |
var t=setInterval(move, 10); | |
function move() | |
{ | |
if(pos>=550) | |
{ | |
clearInterval(t); | |
} | |
else | |
{ | |
pos +=1; | |
box.style.left=pos+'px'; | |
} | |
} | |
}; |
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
.pagecontent { | |
padding: 24px; | |
background-color:yellow; | |
} | |
.page{ | |
background:blue; | |
} | |
p{ | |
color:brown; | |
} | |
#box{ | |
color:red; | |
position:absolute; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment