jQuery的图片剪切插件2

简介: imgAreaSelect imgAreaSelect is a jQuery plugin for selecting a rectangular area of an image. It allows web developers to easily implement image c...

imgAreaSelect

imgAreaSelect is a jQuery plugin for selecting a rectangular area of an image. It allows web developers to easily implement image cropping functionality, as well as other user interface features, such as photo notes (like those on Flickr).

Plugin features:

  • Highly configurable
  • Customizable with CSS styling
  • Handles scaled images
  • Keyboard support for moving and resizing the selection
  • Supports callback functions
  • Provides API functions for easier integration with other application components
  • Lightweight — the packed version is less than 8KB

The plugin works in all major browsers, including Firefox 2+, Opera 9.5+, Google Chrome, Safari 3+, and Internet Explorer 6+.

Live Example

Click and drag on the image to select an area.

Selection Preview

Coordinates Dimensions
X1: Width:
Y1: Height:
X2:    
Y2:    

» See more examples

Quick Usage Instructions

Download the plugin, unzip it, and copy the JavaScript and CSS files to your website/application directory. Load the files in the <head> section of your HTML document.

<head>
  ...
<linkrel="stylesheet"type="text/css"href="css/imgareaselect-default.css"/><scripttype="text/javascript"src="scripts/jquery.min.js"></script><scripttype="text/javascript"src="scripts/jquery.imgareaselect.pack.js"></script>
  ...
</head>

Then, to enable selection on an image, wrap it in a jQuery object and call the imgAreaSelect() method:

<scripttype="text/javascript">
$(document).ready(function(){    $('img#photo').imgAreaSelect({
        handles:true,
        onSelectEnd: someFunction
    });});</script>

» Read documentation

Download

jquery.imgareaselect-0.9.8.zip – a zip archive containing the plugin source (packed version included), a minified version of jQuery, CSS and graphics files, and license text files.

For Developers

For web developers who want to extend/modify the plugin, here's a fully documented version of the source code:
jquery.imgareaselect.dev.js

License

Dual licensed under the MIT and GPL licenses.

Links

imgAreaSelect on jQuery Plugins

imgAreaSelect on GitHub

PHP & jQuery image upload and crop tutorial at WebMotionUK

Using imgAreaSelect and GD library to crop and create thumbnails at Leon Kessler's blog

AjaxCrop – Jquery and PHP Crop tool at Keith Levi Lumanog's blog

目录
相关文章
|
3月前
|
JavaScript
jQuery实现无缝图片滚动效果
jQuery实现无缝图片滚动效果
153 67
|
7月前
|
JavaScript
jQuery图片延迟加载插件jQuery.lazyload
jQuery图片延迟加载插件jQuery.lazyload
|
2月前
|
JavaScript
jQuery 树型菜单插件(Treeview)
jQuery 树型菜单插件(Treeview)
63 2
|
11天前
|
JavaScript
jQuery实现弹窗消息提示特效插件
这是一个简单的jQuery弹窗消息提示插件,用于网站用户操作提示。包含默认、成功、失败、警告、提示弹窗等不同形式弹出的消息提示效果,轻量简单,欢迎下载!
24 4
|
6月前
|
设计模式 JavaScript 前端开发
必知的技术知识:jQuery插件开发精品教程,让你的jQuery提升一个台阶
必知的技术知识:jQuery插件开发精品教程,让你的jQuery提升一个台阶
65 1
|
2月前
|
JavaScript 前端开发
jQuery Growl 插件(消息提醒)
jQuery Growl 插件(消息提醒)
55 4
jQuery Growl 插件(消息提醒)
|
2月前
|
存储 JSON JavaScript
jQuery Cookie 插件
jQuery Cookie 插件
47 4
jQuery Cookie 插件
|
1月前
|
JavaScript 定位技术
jQuery鹰眼视图小地图定位预览插件minimap.js
这是一个jQuery小地图定位预览视图,默认左侧是页面主要内容,minimap.js的好处就是在它的右侧形成一个快速定位通道,产生一个缩小版的页面,即预览效果,可以点击并快速定位到页面的某个位置。简单实用,欢迎下载!
31 0
|
4月前
|
JavaScript 前端开发 数据安全/隐私保护
Validform jQuery插件详解
【8月更文挑战第21天】
|
7月前
|
JavaScript 前端开发
jquery酷炫的马赛克图片还原动画代码
jquery酷炫的马赛克图片还原动画代码,jquery马赛克图片动画,js酷炫图片代码,马赛克图片js还原效果,js图片分散汇聚效果素材
112 1