Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
97 lines (79 sloc) 2.9 KB
<!DOCTYPE HTML>
<html>
<head>
<!-- jQuery -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="jquery-rescale.js"></script>
<title>jquery-rescale Demo</title>
<style type="text/css">
body {
font-family: Helvetica, sans-serif;
}
input {
width: 5em;
}
#controls {
border: 1px solid #aaa;
margin: .5em;
padding: .5em;
}
.rescale {
border: 1px solid #333;
-moz-box-shadow: 6px 6px 6px #666;
-webkit-box-shadow: 6px 6px 6px #666;
box-shadow: 6px 6px 6px #666;
}
</style>
</head>
<body>
<div>
<div id="controls" >
<label for="width">Width:</label>
<input id="width" name="width" type="text" value="200" />
<label for="height">Height:</label>
<input id="height" name="height" type="text" value="200" />
<label for="x">Center X %:</label>
<input id="x" name="x" type="text" value="50" />
<label for="y">Center Y %:</label>
<input id="y" name="y" type="text" value="50" />
<label for="distort">Distort:</label>
<input id="distort" name="distort" type="checkbox" checked />
<label for="direction">Scale direction:</label>
<select id="direction" name="direction">
<option value="-1">Contract Only</option>
<option value="0" selected>Expand or Contract</option>
<option value="1">Expand Only</option>
</select>
</div>
<div class="rescale" >
<div>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<img src="http://upload.wikimedia.org/wikipedia/commons/2/21/Mandel_zoom_00_mandelbrot_set.jpg" height="200" />
</div>
<iframe class="rescale" src="http://en.wikipedia.org/" height="600" width="1000"></iframe>
</div>
<script type="text/javascript">
var rescale = function() {
$('.rescale').rescale(
$('#width').val(),
$('#height').val(),
{
x: $('#x').val(),
y: $('#y').val(),
distort: $('#distort').is(':checked'),
direction: $('#direction').val()
}
);
};
$('input,select').bind('change', rescale);
$(document).ready(rescale);
</script>
</body>
</html>