Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 24cb0ca5dc
Fetching contributors…

Cannot retrieve contributors at this time

67 lines (60 sloc) 2.234 kb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>rcarousel - load elements on demand</title>
<link type="text/css" rel="stylesheet" href="css/reset.css" />
<link type="text/css" rel="stylesheet" href="css/style.css" />
<link type="text/css" rel="stylesheet" href="../widget/css/rcarousel.css" />
<style type="text/css">
#carousel {
width: 300px;
}
</style>
</head>
<body>
<div id="header">
<p>
This is an example of <em>rcarousel</em> – a jQuery UI continuous carousel.
Go back to the <a href="http://ryrych.github.com/rcarousel/">documentation</a>
</p>
</div>
<div id="content">
<h1>Loading elements on demand.</h1>
<div id="carousel">
<img src="images/001.jpg" />
<img src="images/002.jpg" />
<img src="images/003.jpg" />
</div>
<p><input type="button" name="but" id="but" value="load new elements from the server" /></p>
<p><em>May not work locally in some browsers.</em></p>
</div>
<script type="text/javascript" src="../widget/lib/jquery-1.7.1.js"></script>
<script type="text/javascript" src="../widget/lib/jquery.ui.core.js"></script>
<script type="text/javascript" src="../widget/lib/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../widget/lib/jquery.ui.rcarousel.js"></script>
<script type="text/javascript">
jQuery(function($) {
$("#carousel").rcarousel({
step: 1,
auto: {enabled: true}
});
function loadNew() {
var $img,
$jqElements = $();
$.getJSON("remote.json",
function( data ) {
$.each(data.paths, function(i, item) {
$img = $( "<img />" ).attr( "src", item );
$jqElements = $jqElements.add( $img );
});
$( "#carousel" ).rcarousel( "append", $jqElements );
}
);
}
// load new element when clicked
$("#but").click( loadNew );
});
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.