亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

JavaScript 圖片切割效果(帶拖拽,縮放,區域限制

系統 3790 0

?JavaScript 圖片切割效果(帶拖拽,縮放,區域限制)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns=" http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>JavaScript 圖片切割效果(帶拖放、縮放效果) </title>
</head>
<body>

<style type="text/css">
#rRightDown,#rLeftDown,#rLeftUp,#rRightUp,#rRight,#rLeft,#rUp,#rDown{position:absolute;background:#F00;width:5px; height:5px; z-index:500; font-size:0;}
#dragDiv{border:1px solid #000000;}
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
? <tr>
??? <td width="50%"><div id="bgDiv" style="width:400px; height:500px;">
??????? <div id="dragDiv">
????????? <div id="rRightDown" style="right:0; bottom:0;"> </div>
????????? <div id="rLeftDown" style="left:0; bottom:0;"> </div>
????????? <div id="rRightUp" style="right:0; top:0;"> </div>
????????? <div id="rLeftUp" style="left:0; top:0;"> </div>
????????? <div id="rRight" style="right:0; top:50%;"> </div>
????????? <div id="rLeft" style="left:0; top:50%;"> </div>
????????? <div id="rUp" style="top:0; left:50%;"> </div>
????????? <div id="rDown" style="bottom:0;left:50%;"></div>
??????? </div>
????? </div></td>
??? <td><div id="viewDiv" style="width:200px; height:200px;"> </div></td>
? </tr>
</table>
<script>

var $ = function (id) {
??? return "string" == typeof id ? document.getElementById(id) : id;
};

var isIE = (document.all) ? true : false;

function addEventHandler(oTarget, sEventType, fnHandler) {
?if (oTarget.addEventListener) {
? oTarget.addEventListener(sEventType, fnHandler, false);
?} else if (oTarget.attachEvent) {
? oTarget.attachEvent("on" + sEventType, fnHandler);
?} else {
? oTarget["on" + sEventType] = fnHandler;
?}
};

function removeEventHandler(oTarget, sEventType, fnHandler) {
??? if (oTarget.removeEventListener) {
??????? oTarget.removeEventListener(sEventType, fnHandler, false);
??? } else if (oTarget.detachEvent) {
??????? oTarget.detachEvent("on" + sEventType, fnHandler);
??? } else {
??????? oTarget["on" + sEventType] = null;
??? }
};


var Class = {
? create: function() {
??? return function() {
????? this.initialize.apply(this, arguments);
??? }
? }
}

Object.extend = function(destination, source) {
??? for (var property in source) {
??????? destination[property] = source[property];
??? }
??? return destination;
}

//拖放程序
var Drag = Class.create();
Drag.prototype = {
? //拖放對象,觸發對象
? initialize: function(obj, drag, options) {
??? var oThis = this;
?
?this._obj = $(obj);//拖放對象
?this.Drag = $(drag);//觸發對象
?this._x = this._y = 0;//記錄鼠標相對拖放對象的位置
?//事件對象(用于移除事件)
?this._fM = function(e){ oThis.Move(window.event || e); }
?this._fS = function(){ oThis.Stop(); }
?
?this.SetOptions(options);
?
?this.Limit = !!this.options.Limit;
?this.mxLeft = parseInt(this.options.mxLeft);
?this.mxRight = parseInt(this.options.mxRight);
?this.mxTop = parseInt(this.options.mxTop);
?this.mxBottom = parseInt(this.options.mxBottom);
?
?this.onMove = this.options.onMove;
?
?this._obj.style.position = "absolute";
?addEventHandler(this.Drag, "mousedown", function(e){ oThis.Start(window.event || e); });
? },
? //設置默認屬性
? SetOptions: function(options) {
??? this.options = {//默認值
? Limit:? false,//是否設置限制(為true時下面參數有用,可以是負數)
? mxLeft:? 0,//左邊限制
? mxRight: 0,//右邊限制
? mxTop:? 0,//上邊限制
? mxBottom: 0,//下邊限制
? onMove:? function(){}//移動時執行
??? };
??? Object.extend(this.options, options || {});
? },
? //準備拖動
? Start: function(oEvent) {
?//記錄鼠標相對拖放對象的位置
?this._x = oEvent.clientX - this._obj.offsetLeft;
?this._y = oEvent.clientY - this._obj.offsetTop;
?//mousemove時移動 mouseup時停止
?addEventHandler(document, "mousemove", this._fM);
?addEventHandler(document, "mouseup", this._fS);
?//使鼠標移到窗口外也能釋放
?if(isIE){
? addEventHandler(this.Drag, "losecapture", this._fS);
? this.Drag.setCapture();
?}else{
? addEventHandler(window, "blur", this._fS);
?}
? },
? //æ‹–å‹•
? Move: function(oEvent) {
?//清除選擇(ie設置捕獲后默認帶這個)
?window.getSelection && window.getSelection().removeAllRanges();
?//當前鼠標位置減去相對拖放對象的位置得到offset位置
?var iLeft = oEvent.clientX - this._x, iTop = oEvent.clientY - this._y;
?//設置范圍限制
?if(this.Limit){
? //獲取超出長度
? var iRight = iLeft + this._obj.offsetWidth - this.mxRight, iBottom = iTop + this._obj.offsetHeight - this.mxBottom;
? //這里是先設置右邊下邊再設置左邊上邊,可能會不準確
? if(iRight > 0) iLeft -= iRight;
? if(iBottom > 0) iTop -= iBottom;
? if(this.mxLeft > iLeft) iLeft = this.mxLeft;
? if(this.mxTop > iTop) iTop = this.mxTop;
?}
?//設置位置
?this._obj.style.left = iLeft + "px";
?this._obj.style.top = iTop + "px";
?//附加程序
?this.onMove();
? },
? //停止拖動
? Stop: function() {
?//移除事件
?removeEventHandler(document, "mousemove", this._fM);
?removeEventHandler(document, "mouseup", this._fS);
?if(isIE){
? removeEventHandler(this.Drag, "losecapture", this._fS);
? this.Drag.releaseCapture();
?}else{
? removeEventHandler(window, "blur", this._fS);
?}
? }
};

//縮放程序
var Resize = Class.create();
Resize.prototype = {
? //縮放對象
? initialize: function(obj, options) {
??? var oThis = this;
?
?this._obj = $(obj);//縮放對象
?this._right = this._down = this._left = this._up = 0;//坐標參數
?this._scale = 1;//比例參數
?this._touch = null;//當前觸發對象
?
?//用currentStyle(ff用getComputedStyle)取得最終樣式
?var _style = this._obj.currentStyle || document.defaultView.getComputedStyle(this._obj, null);
?this._xBorder = parseInt(_style.borderLeftWidth) + parseInt(_style.borderRightWidth);
?this._yBorder = parseInt(_style.borderTopWidth) + parseInt(_style.borderBottomWidth);
?
?//事件對象(用于移除事件)
?this._fR = function(e){ oThis.Resize(e); }
?this._fS = function(){ oThis.Stop(); }
?
?this.SetOptions(options);
?
?this.Limit = !!this.options.Limit;
?this.mxLeft = parseInt(this.options.mxLeft);
?this.mxRight = parseInt(this.options.mxRight);
?this.mxTop = parseInt(this.options.mxTop);
?this.mxBottom = parseInt(this.options.mxBottom);
?
?this.MinWidth = parseInt(this.options.MinWidth);
?this.MinHeight = parseInt(this.options.MinHeight);
?this.Scale = !!this.options.Scale;
?this.onResize = this.options.onResize;
?
?this._obj.style.position = "absolute";
? },
? //設置默認屬性
? SetOptions: function(options) {
??? this.options = {//默認值
? Limit:? false,//是否設置限制(為true時下面mx參數有用)
? mxLeft:? 0,//左邊限制
? mxRight: 0,//右邊限制
? mxTop:? 0,//上邊限制
? mxBottom: 0,//下邊限制
? MinWidth: 50,//最小寬度
? MinHeight: 50,//最小高度
? Scale:? false,//是否按比例縮放
? onResize: function(){}//縮放時執行
??? };
??? Object.extend(this.options, options || {});
? },
? //設置觸發對象
? Set: function(resize, side) {
?var oThis = this, resize = $(resize), _fun, _cursor;
?if(!resize) return;
?//根據方向設置 _fun是縮放時執行的程序 _cursor是鼠標樣式
?switch (side.toLowerCase()) {
?case "up" :
? _fun = function(e){ if(oThis.Scale){ oThis.scaleUpRight(e); }else{ oThis.SetUp(e); } };
? _cursor = "n-resize";
? break;
?case "down" :
? _fun = function(e){ if(oThis.Scale){ oThis.scaleDownRight(e); }else{ oThis.SetDown(e); } };
? _cursor = "n-resize";
? break;
?case "left" :
? _fun = function(e){ if(oThis.Scale){ oThis.scaleLeftUp(e); }else{ oThis.SetLeft(e); } };
? _cursor = "e-resize";
? break;
?case "right" :
? _fun = function(e){ if(oThis.Scale){ oThis.scaleRightDown(e); }else{ oThis.SetRight(e); } };
? _cursor = "e-resize";
? break;
?case "left-up" :
? _fun = function(e){ if(oThis.Scale){ oThis.scaleLeftUp(e); }else{ oThis.SetLeft(e); oThis.SetUp(e); } };
? _cursor = "nw-resize";
? break;
?case "right-up" :
? _fun = function(e){ if(oThis.Scale){ oThis.scaleRightUp(e); }else{ oThis.SetRight(e); oThis.SetUp(e); } };
? _cursor = "ne-resize";
? break;
?case "left-down" :
? _fun = function(e){ if(oThis.Scale){ oThis.scaleLeftDown(e); }else{ oThis.SetLeft(e); oThis.SetDown(e); } };
? _cursor = "ne-resize";
? break;
?case "right-down" :
?default :
? _fun = function(e){ if(oThis.Scale){ oThis.scaleRightDown(e); }else{ oThis.SetRight(e); oThis.SetDown(e); } };
? _cursor = "nw-resize";
?}
?//插入字符解決ff下捕獲效的問題
?if(!isIE){ resize.innerHTML = "<font size='1px'>&nbsp;</font>"; }
?//設置觸發對象
?resize.style.cursor = _cursor;
?addEventHandler(resize, "mousedown", function(e){ oThis._fun = _fun; oThis._touch = resize; oThis.Start(window.event || e); });
? },
? //準備縮放
? Start: function(oEvent, o) {
?//防止冒泡
?if(isIE){ oEvent.cancelBubble = true; } else { oEvent.stopPropagation(); }
?//計算樣式初始值
?this.style_width = this._obj.offsetWidth;
?this.style_height = this._obj.offsetHeight;
?this.style_left = this._obj.offsetLeft;
?this.style_top = this._obj.offsetTop;
?//設置縮放比例
?if(this.Scale){ this._scale = this.style_width / this.style_height; }
?//計算當前邊的對應另一條邊的坐標 例如右邊縮放時需要左邊界坐標
?this._left = oEvent.clientX - this.style_width;
?this._right = oEvent.clientX + this.style_width;
?this._up = oEvent.clientY - this.style_height;
?this._down = oEvent.clientY + this.style_height;
?//如果有范圍 先計算好范圍內最大寬度和高度
?if(this.Limit){
? this._mxRight = this.mxRight - this._obj.offsetLeft;
? this._mxDown = this.mxBottom - this._obj.offsetTop;
? this._mxLeft = this.mxLeft + this.style_width + this._obj.offsetLeft;
? this._mxUp = this.mxTop + this.style_height + this._obj.offsetTop;
?}
?//mousemove時縮放 mouseup時停止
?addEventHandler(document, "mousemove", this._fR);
?addEventHandler(document, "mouseup", this._fS);
?
?//使鼠標移到窗口外也能釋放
?if(isIE){
? addEventHandler(this._touch, "losecapture", this._fS);
? this._touch.setCapture();
?}else{
? addEventHandler(window, "blur", this._fS);
?}
? },
? //縮放
? Resize: function(e) {
?//沒有觸發對象的話返回
?if(!this._touch) return;
?//清除選擇(ie設置捕獲后默認帶這個)
?window.getSelection && window.getSelection().removeAllRanges();
?//執行縮放程序
?this._fun(window.event || e);
?//設置樣式
?//因為計算用的offset是把邊框算進去的所以要減去
?this._obj.style.width = this.style_width - this._xBorder + "px";
?this._obj.style.height = this.style_height - this._yBorder + "px";
?this._obj.style.top = this.style_top + "px";
?this._obj.style.left = this.style_left + "px";
?//附加程序
?this.onResize();
? },
? //普通縮放
? //右邊
? SetRight: function(oEvent) {
?//當前坐標位置減去左邊的坐標等于當前寬度
?this.repairRight(oEvent.clientX - this._left);
? },
? //下邊
? SetDown: function(oEvent) {
?this.repairDown(oEvent.clientY - this._up);
? },
? //左邊
? SetLeft: function(oEvent) {
?//右邊的坐標減去當前坐標位置等于當前寬度
?this.repairLeft(this._right - oEvent.clientX);
? },
? //上邊
? SetUp: function(oEvent) {
?this.repairUp(this._down - oEvent.clientY);
? },
? //比例縮放
? //比例縮放右下
? scaleRightDown: function(oEvent) {
?//先計算寬度然后按比例計算高度最后根據確定的高度計算寬度(寬度優先)
?this.SetRight(oEvent);
?this.repairDown(parseInt(this.style_width / this._scale));
?this.repairRight(parseInt(this.style_height * this._scale));
? },
? //比例縮放左下
? scaleLeftDown: function(oEvent) {
?this.SetLeft(oEvent);
?this.repairDown(parseInt(this.style_width / this._scale));
?this.repairLeft(parseInt(this.style_height * this._scale));
? },
? //比例縮放右上
? scaleRightUp: function(oEvent) {
?this.SetRight(oEvent);
?this.repairUp(parseInt(this.style_width / this._scale));
?this.repairRight(parseInt(this.style_height * this._scale));
? },
? //比例縮放左上
? scaleLeftUp: function(oEvent) {
?this.SetLeft(oEvent);
?this.repairUp(parseInt(this.style_width / this._scale));
?this.repairLeft(parseInt(this.style_height * this._scale));
? },
? //這里是高度優先用于上下兩邊(體驗更好)
? //比例縮放下右
? scaleDownRight: function(oEvent) {
?this.SetDown(oEvent);
?this.repairRight(parseInt(this.style_height * this._scale));
?this.repairDown(parseInt(this.style_width / this._scale));
? },
? //比例縮放上右
? scaleUpRight: function(oEvent) {
?this.SetUp(oEvent);
?this.repairRight(parseInt(this.style_height * this._scale));
?this.repairUp(parseInt(this.style_width / this._scale));
? },
? //修正程序
? //修正右邊
? repairRight: function(iWidth) {
?//右邊和下邊只要設置寬度和高度就行
?//當少于最少寬度
?if (iWidth < this.MinWidth){ iWidth = this.MinWidth; }
?//當超過當前設定的最大寬度
?if(this.Limit && iWidth > this._mxRight){ iWidth = this._mxRight; }
?//修改樣式
?this.style_width = iWidth;
? },
? //修正下邊
? repairDown: function(iHeight) {
?if (iHeight < this.MinHeight){ iHeight = this.MinHeight; }
?if(this.Limit && iHeight > this._mxDown){ iHeight = this._mxDown; }
?this.style_height = iHeight;
? },
? //修正左邊
? repairLeft: function(iWidth) {
?//左邊和上邊比較麻煩 因為還要計算left和top
?//當少于最少寬度
?if (iWidth < this.MinWidth){ iWidth = this.MinWidth; }
?//當超過當前設定的最大寬度
?else if(this.Limit && iWidth > this._mxLeft){ iWidth = this._mxLeft; }
?//修改樣式
?this.style_width = iWidth;
?this.style_left = this._obj.offsetLeft + this._obj.offsetWidth - iWidth;
? },
? //修正上邊
? repairUp: function(iHeight) {
?if(iHeight < this.MinHeight){ iHeight = this.MinHeight; }
?else if(this.Limit && iHeight > this._mxUp){ iHeight = this._mxUp; }
?this.style_height = iHeight;
?this.style_top = this._obj.offsetTop + this._obj.offsetHeight - iHeight;
? },
? //停止縮放
? Stop: function() {
?//移除事件
?removeEventHandler(document, "mousemove", this._fR);
?removeEventHandler(document, "mouseup", this._fS);
?if(isIE){
? removeEventHandler(this._touch, "losecapture", this._fS);
? this._touch.releaseCapture();
?}else{
? removeEventHandler(window, "blur", this._fS);
?}
?this._touch = null;
? }
};


//圖片切割
var ImgCropper = Class.create();
ImgCropper.prototype = {
? //容器對象,拖放縮放對象,圖片地址,寬度,高度
? initialize: function(container, drag, url, width, height, options) {
?var oThis = this;
?
?//容器對象
?this.Container = $(container);
?this.Container.style.position = "relative";
?this.Container.style.overflow = "hidden";
?
?//拖放對象
?this.Drag = $(drag);
?this.Drag.style.cursor = "move";
?this.Drag.style.zIndex = 200;
?if(isIE){
? //設置overflow解決ie6的渲染問題(縮放時填充對象高度的問題)
? this.Drag.style.overflow = "hidden";
? //ie下用一個透明的層填充拖放對象 不填充的話onmousedown會失效(未知原因)
? (function(style){
?? style.width = style.height = "100%"; style.backgroundColor = "#fff"; style.filter = "alpha(opacity:0)";
? })(this.Drag.appendChild(document.createElement("div")).style)
?}else{
? //插入字符解決ff下捕獲失效的問題
? this.Drag.innerHTML += "<font size='1px'>&nbsp;</font>";
?}
?
?this._pic = this.Container.appendChild(document.createElement("img"));//圖片對象
?this._cropper = this.Container.appendChild(document.createElement("img"));//切割對象
?this._pic.style.position = this._cropper.style.position = "absolute";
?this._pic.style.top = this._pic.style.left = this._cropper.style.top = this._cropper.style.left = "0";//對齊
?this._cropper.style.zIndex = 100;
?this._cropper.onload = function(){ oThis.SetPos(); }
?
?this.Url = url;//圖片地址
?this.Width = parseInt(width);//寬度
?this.Height = parseInt(height);//高度
?
?this.SetOptions(options);
?
?this.Opacity = parseInt(this.options.Opacity);
?this.dragTop = parseInt(this.options.dragTop);
?this.dragLeft = parseInt(this.options.dragLeft);
?this.dragWidth = parseInt(this.options.dragWidth);
?this.dragHeight = parseInt(this.options.dragHeight);
?
?//設置預覽對象
?this.View = $(this.options.View) || null;//預覽對象
?this.viewWidth = parseInt(this.options.viewWidth);
?this.viewHeight = parseInt(this.options.viewHeight);
?this._view = null;//預覽圖片對象
?if(this.View){
? this.View.style.position = "relative";
? this.View.style.overflow = "hidden";
? this._view = this.View.appendChild(document.createElement("img"));
? this._view.style.position = "absolute";
?}
?
?this.Scale = parseInt(this.options.Scale);
?
?//設置拖放
?this._drag = new Drag(this.Drag, this.Drag, { Limit: true, onMove: function(){ oThis.SetPos(); } });
?//設置縮放
?this._resize = this.GetResize();
?
?this.Init();
? },
? //設置默認屬性
? SetOptions: function(options) {
??? this.options = {//默認值
? Opacity: 50,//透明度(0到100)
? //拖放位置和寬高
? dragTop: 0,
? dragLeft: 0,
? dragWidth: 100,
? dragHeight: 100,
? //縮放觸發對象
? Right:? "",
? Left:? "",
? Up:?? "",
? Down:? "",
? RightDown: "",
? LeftDown: "",
? RightUp: "",
? LeftUp:? "",
? Scale:? false,//是否按比例縮放
? //預覽對象設置
? View: "",//預覽對象
? viewWidth: 100,//預覽寬度
? viewHeight: 100//預覽高度
??? };
??? Object.extend(this.options, options || {});
? },
? //初始化對象
? Init: function() {
?var oThis = this;
?
?//設置容器
?this.Container.style.width = this.Width + "px";
?this.Container.style.height = this.Height + "px";
?
?//設置拖放對象
?this.Drag.style.top = this.dragTop + "px";
?this.Drag.style.left = this.dragLeft + "px";
?this.Drag.style.width = this.dragWidth + "px";
?this.Drag.style.height = this.dragHeight + "px";
?
?//設置切割對象
?this._pic.src = this._cropper.src = this.Url;
?this._pic.style.width = this._cropper.style.width = this.Width + "px";
?this._pic.style.height = this._cropper.style.height = this.Height + "px";
?if(isIE){
? this._pic.style.filter = "alpha(opacity:" + this.Opacity + ")";
?} else {
? this._pic.style.opacity = this.Opacity / 100;
?}
?
?//設置預覽對象
?if(this.View){ this._view.src = this.Url; }
?
?//設置拖放
?this._drag.mxRight = this.Width; this._drag.mxBottom = this.Height;
?//設置縮放
?if(this._resize){ this._resize.mxRight = this.Width; this._resize.mxBottom = this.Height; this._resize.Scale = this.Scale; }
? },
? //設置獲取縮放對象
? GetResize: function() {
?var op = this.options;
?//有觸發對象時才設置
?if(op.RightDown || op.LeftDown || op.RightUp || op.LeftUp || op.Right || op.Left || op.Up || op.Down ){
? var oThis = this, _resize = new Resize(this.Drag, { Limit: true, onResize: function(){ oThis.SetPos(); } });
?
? //設置縮放觸發對象
? if(op.RightDown){ _resize.Set(op.RightDown, "right-down"); }
? if(op.LeftDown){ _resize.Set(op.LeftDown, "left-down"); }
?
? if(op.RightUp){ _resize.Set(op.RightUp, "right-up"); }
? if(op.LeftUp){ _resize.Set(op.LeftUp, "left-up"); }
?
? if(op.Right){ _resize.Set(op.Right, "right"); }
? if(op.Left){ _resize.Set(op.Left, "left"); }
?
? if(op.Up){ _resize.Set(op.Up, "up"); }
? if(op.Down){ _resize.Set(op.Down, "down"); }
?
? return _resize;
?} else { return null; }
? },
? //設置切割
? SetPos: function() {
?var o = this.Drag;
?//按拖放對象的參數進行切割
?this._cropper.style.clip = "rect(" + o.offsetTop + "px " + (o.offsetLeft + o.offsetWidth) + "px " + (o.offsetTop + o.offsetHeight) + "px " + o.offsetLeft + "px)";
?//切割預覽
?if(this.View) this.PreView();
? },
? //切割預覽
? PreView: function() {
?//按比例設置寬度和高度
?var o = this.Drag, h = this.viewWidth, w = h * o.offsetWidth / o.offsetHeight;
?if(w > this.viewHeight){ w = this.viewHeight; h = w * o.offsetHeight / o.offsetWidth; }
?//獲取對應比例尺寸
?var scale = h / o.offsetHeight, ph = this.Height * scale, pw = this.Width * scale, pt = o.offsetTop * scale, pl = o.offsetLeft * scale, styleView = this._view.style;
?//設置樣式
?styleView.width = pw + "px"; styleView.height = ph + "px";
?styleView.top = - pt + "px "; styleView.left = - pl + "px";
?//切割預覽圖
?styleView.clip = "rect(" + pt + "px " + (pl + w) + "px " + (pt + h) + "px " + pl + "px)";
? }
}

var ic = new ImgCropper("bgDiv", "dragDiv", " http://images.cnblogs.com/cnblogs_com/cloudgamer/143727/r_min.jpg ", 400, 500, {
?dragTop: 50, dragLeft: 50,
?Right: "rRight", Left: "rLeft", Up: "rUp", Down: "rDown",
?RightDown: "rRightDown", LeftDown: "rLeftDown", RightUp: "rRightUp", LeftUp: "rLeftUp",
?View: "viewDiv", viewWidth: 200, viewHeight: 200
})
</script>
<script>

//設置圖片大小
function Size(w, h){
?ic.Width = w;
?ic.Height = h;
?ic.Init();
}
//換圖片
function Pic(url){
?ic.Url = url;
?ic.Init();
}
//設置透明度
function Opacity(i){
?ic.Opacity = i;
?ic.Init();
}
//是否使用比例
function Scale(b){
?ic.Scale = b;
?ic.Init();
}


</script>
<br />
<br />
<div>
? <input name="" type="button" value=" 增肥 " onclick="Size(500,400)" />
? <input name="" type="button" value=" 還原 " onclick="Size(300,400)" />
</div>

<br />
<div>
? <input name="" type="button" value=" 換圖 " onclick="Pic('http://images.cnblogs.com/cnblogs_com/cloudgamer/143727/r_min.jpg')" />
? <input name="" type="button" value=" 還原 " onclick="Pic('http://images.cnblogs.com/cnblogs_com/cloudgamer/143727/r_xx2.jpg')" />
</div>

<br />
<div>
? <input name="" type="button" value=" 透明 " onclick="Opacity(0)" />
? <input name="" type="button" value=" 還原 " onclick="Opacity(50)" />
</div>

<br />
<div>
? <input name="" type="button" value="使用比例" onclick="Scale(true)" />
? <input name="" type="button" value="取消比例" onclick="Scale(false)" />
</div>

</body>
</html>

?

運行效果圖:

? JavaScript 圖片切割效果(帶拖拽,縮放,區域限制)

JavaScript 圖片切割效果(帶拖拽,縮放,區域限制)


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】元

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 国产小视频在线观看免费 | 一区二区三区四区亚洲 | 日本不卡视频免费 | 夜色99| 成人嫩草研究院永久网址 | 欧美中文字幕在线播放 | 日本护士a做爰免费观看 | 奇米影视777在线观看 | 亚洲精品国自产拍影院 | 性做久久久久久久久男女 | 韩国日本美国免费毛片 | 欧美日韩在线观看视频 | 婷婷综合国产激情在线 | 久久中文字幕亚洲精品最新 | 久青草国产在视频在线观看 | 精品免费久久久久国产一区 | 国产精品一区二区欧美视频 | 99免费观看视频 | 男人私人影院免费看视频 | 最新国产精品视频 | 日日操综合 | 国产免费一区二区三区免费视频 | 九九热视频精品在线 | 午夜小视频网站 | 俄罗斯午夜影院 | 视频一区久久 | 2021最新国产成人精品视频 | 久久99久久99精品免费看动漫 | 四虎hu| 夜夜超b天天 | 国产精品你懂的在线播放 | 欧美亚洲综合在线观看 | 九九爱精品视频 | 黄色免费观看视频网站 | 69美女福利视频在线观看 | 四虎影视色费永久在线观看 | 同性女女黄h片在线播放 | 一级毛片视频免费观看 | 毛片网站在线观看 | 久久中文字幕综合不卡一二区 | 国产精品一级毛片不收费 |