Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
2.7 KiB

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" xml:lang="en" lang="en">
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en-us" />
<title>CSS - Relative test</title>
<script src="../lib/prototype.js" type="text/javascript"></script>
<script src="../lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
<script src="../cropper.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
// setup the callback function
function onEndCrop( coords, dimensions ) {
$( 'x1' ).value = coords.x1;
$( 'y1' ).value = coords.y1;
$( 'x2' ).value = coords.x2;
$( 'y2' ).value = coords.y2;
$( 'width' ).value = dimensions.width;
$( 'height' ).value = dimensions.height;
// relative example
function() {
new Cropper.Img(
onEndCrop: onEndCrop
if( typeof(dump) != 'function' ) {
Debug.init(true, '/');
function dump( msg ) {
Debug.raise( msg );
} else dump( '---------------------------------------\n' );
<link rel="stylesheet" type="text/css" href="debug.css" media="all" />
<style type="text/css">
label {
clear: left;
margin-left: 50px;
float: left;
width: 5em;
html, body {
margin: 0;
#testWrap {
margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */
#test-relative {
background-color: #ccc;
border: 3px solid #ddd;
position: relative;
top: 25px;
left: 25px;
<h2>Test page with relatively positioned wrapper</h2>
Some test content before the image
<div id="test-relative">
<h2>Relative test</h2>
<div id="testWrap">
<img src="castle.jpg" alt="test image" id="testImage" width="500" height="333" />
<label for="x1">x1:</label>
<input type="text" name="x1" id="x1" />
<label for="y1">y1:</label>
<input type="text" name="y1" id="y1" />
<label for="x2">x2:</label>
<input type="text" name="x2" id="x2" />
<label for="y2">y2:</label>
<input type="text" name="y2" id="y2" />
<label for="width">width:</label>
<input type="text" name="width" id="width" />
<label for="height">height</label>
<input type="text" name="height" id="height" />