Created
June 13, 2012 11:45
-
-
Save ryuichimatsumoto-single/2923595 to your computer and use it in GitHub Desktop.
motion:earthquake using JQuery (JQueryを用いた地震のようなモーション)
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> | |
<script src="http://code.jquery.com/jquery-latest.js"></script> | |
<script> | |
$(document).ready(function(){ | |
$("#right").click(function(){ | |
$(".block").animate({"left": "+=50px"}, "slow"); | |
}); | |
$("#left").click(function(){ | |
$(".block").animate({"left": "+=80px"}, "slow"); | |
$(".block").animate({"left": "-=40px"}, "slow"); | |
$(".block").animate({"left": "+=40px"}, "slow"); | |
$(".block").animate({"left": "-=20px"}, "slow"); | |
$(".block").animate({"left": "+=20px"}, "slow"); | |
$(".block").animate({"left": "-=10px"}, "slow"); | |
$(".block").animate({"left": "+=10px"}, "slow"); | |
$(".block").animate({"left": "-=5px"}, "slow"); | |
$(".block").animate({"left": "+=5px"}, "slow"); | |
$(".block").animate({"left": "-=2px"}, "slow"); | |
}); | |
}); | |
</script> | |
<style> | |
div { | |
position:absolute; | |
background-color:#abc; | |
left:100px; | |
width:90px; | |
height:90px; | |
margin:5px; | |
} | |
</style> | |
</head> | |
<body> | |
<button id="left">実行</button> | |
<div class="block"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment