Created
November 14, 2015 15:17
-
-
Save Kanol/9e004c2a3e5f6fbcf8e1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> | |
<style> | |
.square{ | |
position:absolute; | |
width:100px; | |
height:100px; | |
background: red; | |
top: 0px; | |
left:0px; | |
} | |
</style> | |
</head> | |
<body> | |
<div class='square'></div> | |
</body> | |
</html> | |
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> | |
<script> | |
function timer(){ | |
setTimeout(move, 1500); | |
} | |
function move(){ | |
var w = $(window).width() - 101; | |
var h = $(window).height() - 101; | |
s.animate({'left':w}); | |
s.animate({'top':h}); | |
s.animate({'left':x}); | |
s.animate({'top':y}); | |
timer(); | |
} | |
var s=$('.square'); | |
var x=0; | |
var y =0; | |
timer(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment