The example in action
Current selection:
x= y= width= height=
Click on the image and release the button.
Then move the mouse - you should see a rectangular selection following your mouse.
Click again to stop selecting.
|
Why the name "jfirst"?J. - Javascript F. - Free I. - Image R. - Rectangular S. - Selection T. - Tool What is what?
How does it work? (in response to: "I click on the image and move the mouse elsewhere while holding the button - but nothing happens!")Click on the image and release the button. Then move the mouse - you should see a rectangular selection following your mouse. Click again to stop selecting. This interface was chosen in order to avoid side-effects in firefox. Source codeStyle#container {
/* crossbrowser opacity.
Actually, it would be be better to use
conditional comments for MSIE */
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
opacity:.3;
/* put a border arounf the image */
border:1px solid black;
}
.jfirst-selection {
/* put a border arond the selection-area.
Note: border-width should be the same as
for the container element above */
border:1px solid lightgreen;
}
Notes on styling
Markup<!-- This is where image will be shown --> <div id="container"></div> <!-- This is the status line with HTML inputs - so that we could submit information to the server --> <div id="status"> Current selection: <br /> x=<input type="text" readonly="true()" name="crop_x" id="crop_x" value="0" /> y=<input type="text" readonly="true()" name="crop_y" id="crop_y" value="0" /> width=<input type="text" readonly="true()" name="crop_w" id="crop_w" value="0" /> height=<input type="text" readonly="true()" name="crop_h" id="crop_h" value="0" /> </div> And, finally, the script
<script>
new jFirst("tux.png", 200, 283)./* Create jFirst instance */
/* Bind HTML input elements */
bindXInput('crop_x').bindYInput('crop_y').
bindWidthInput('crop_w').bindHeightInput('crop_h').
render("container");/* Render jFirst GUI */
</script>
Contact meQuestions, wishes etc: crocodile2u at yandex dot ru |