Skip to content

Instantly share code, notes, and snippets.

@rjungemann
Created February 1, 2010 06:58
Show Gist options
  • Save rjungemann/291508 to your computer and use it in GitHub Desktop.
Save rjungemann/291508 to your computer and use it in GitHub Desktop.
A "moving clouds" example with JQuery
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<!-- An example of using JQuery to make looping clouds. -->
<head>
<title>Transition Test</title>
<style>
#frame {
width: 600px;
height: 400px;
overflow: hidden;
}
#slider {
position: relative;
width: 1200px;
}
.one, .two {
width: 600px;
height: 400px;
float: left;
}
</style>
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript">
$(function() {
function resetAnimation() {
$("#slider").animate({ "left": "-=600px"}, 10000, function() {
$("#slider").css("left", "0");
resetAnimation();
});
}
resetAnimation();
});
</script>
</head>
<body>
<div id="header">
<h1>Transition Test</h1>
</div>
<div id="frame">
<div id="slider">
<img src="images/clouds.jpg" class="one">
<img src="images/clouds.jpg" class="two">
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment