Execute
Save
Share
Share link
share
share
share
Team
Public Teams
Comments
0
Created By:
Guest
Title:
code of select show area img
Title
Description
Edit
Copy Link
Login
Email *
Password *
Login
OR
Create Account
Screen Name *
Email *
Password *
Retype Password *
Team Access Code
Register
Public CodeBins
HELP
--Select Theme--
Ambiance
Blackboard
Cobalt
Eclipse
Elegant
Erlang-Dark
Lesser-Dark
Monokai
Neat
Night
Rubyblue
Vibrant-Ink
Xq-Dark
New CodeBin
CodeBins Versions
code of select - V.25
code of select - V.24
code of select - V.23
code of select - V.22
code of select - V.21
code of select - V.20
code of select - V.19
code of select - V.18
code of select - V.17
code of select - V.16
code of select - V.15
code of select - V.14
code of select - V.13
code of select - V.12
code of select - V.11
code of select - V.10
code of select - V.9
code of select - V.8
code of select - V.7
code of select - V.6
code of select - V.5
code of select - V.4
code of select - V.3
code of select - V.2
code of select - V.1
Compare Versions
Recent CodeBins
View All CodeBins
function preview(img, selection) { if (!selection.width || !selection.height) return; var scaleX = 100 / selection.width; var scaleY = 100 / selection.height; $('#preview img').css({ width: Math.round(scaleX * 200), height: Math.round(scaleY * 200), marginLeft: -Math.round(scaleX * selection.x1), marginTop: -Math.round(scaleY * selection.y1) }); $('#x1').val(selection.x1); $('#y1').val(selection.y1); $('#x2').val(selection.x2); $('#y2').val(selection.y2); $('#w').val(selection.width); $('#h').val(selection.height); } $(function() { $('#photo').imgAreaSelect({ handles: false, fadeSpeed: 200, onSelectChange: preview, resizable: false, persistent: true, show: true, x1: 10, y1: 10, x2: 100, y2: 100 }); });
Bottom of Page
In Head
On Load
On Ready
Setting
Validate
Copy
Format
#demo{ background: none repeat scroll 0 0 #EEEEEE; border: 2px solid #999; border-radius: 4px 4px 4px 4px; padding: 0.6em; float: left; width:90%; } .leftside{ float: left; width:50%; } .rightside{ float: left; margin-top:11%; width:40%; } #demo p.instructions { color: #666666; font-family: serif; font-style: italic; line-height: 130%; font-size:13px; } div.frame { background: none repeat scroll 0 0 #FFFFFF; border: 2px solid #DDDDDD; padding: 0.8em; } .leftframe{ margin: 0 0.3em; width: 200px; height: 200px; } .rightframe{ margin: 0 1em; width: 100px; height: 100px; http://codebins.com/# } .previewframe{ width: 100px; height: 100px; overflow: hidden; } .crop{ margin-left:20%; margin-top:1%; } .imginfo{ font-size:13px; width:100%; } .imginfo input[type=text]{ width:80px; text-align:right; border:1px solid #666; }
Setting
Validate
Copy
Format
<div id="demo"> <div class="leftside"> <p class="instructions"> Click and drag on the image to select an area. </p> <div class="frame leftframe"> <img src="https://solarsystem.nasa.gov/system/basic_html_elements/11561_Sun.png" id="photo"> </div> </div> <div class="rightside"> <div class="frame rightframe"> <div class="previewframe" id="preview"> <img style="width: 100px; height: 100px;" src="https://solarsystem.nasa.gov/system/basic_html_elements/11561_Sun.png" /> </div> </div> <table class="imginfo"> <tr> <th colspan="2"> Coordinates </th> <th colspan="2"> Dimensions </th> </tr> <tr> <td> X1: </td> <td> <input type="text" value="-" id="x1" /> </td> <td> Width: </td> <td> <input type="text" value="-" id="w" /> </td> </tr> <tr> <td> Y1: </td> <td> <input type="text" value="-" id="y1" /> </td> <td> Height: </td> <td> <input type="text" value="-" id="h" /> </td> </tr> <tr> <td> X2: </td> <td> <input type="text" value="-" id="x2" /> </td> <td colspan="2"> </td> </tr> <tr> <td> Y2: </td> <td> <input type="text" value="-" id="y2" /> </td> <td colspan="2"> </td> </tr> </table> </div> </div>
No Doc Type
HTML5
HTML 4.01 Transitional
HTML 4.01 Strict
HTML 4.01 Frameset
XHTML 1.1
XHTML 1.0 Transitional
XHTML 1.0 Strict
XHTML 1.0 Frameset
Copy
Format
Download
×
Code Description
×
Difference of Versions
HTML
CSS
JS
×
JS Error
×
CSS Error
Errors
Warnings
×
JavaScript Setting
JS Libraries:
Chrome Frame 1.0.3
Dojo 1.8.0
Dojo 1.7.3
Dojo 1.7.2
Ext Core 3.1.0
jQuery 1.8.0
jQuery 1.7.2
jQuery 1.6.0
jQuery 1.5.0
jQuery 1.4.4
jQuery 1.4.0
jQuery-min 1.7.2
jQueryUI-min 1.8.21
MooTools more-1.4.0.1-full
MooTools core-1.4.5-full
MooTools core-1.4.1-full
Prototype 1.7.1.0
script.aculo.us 1.9.0
SWFObject 2.2
Twitter Bootstrap 2.0.4
WebFont Loader 1.0.28
yui 3.5.1
User Libraries:
Upload File
JavaScript URL(s):
×
CSS Setting
CSS Libraries:
jQueryUI 1.8.21
Twitter Bootstrap 2.0.4
User Libraries:
Upload File
CSS URL(s):