jquery实现图片缩放
<img id="img" onmousewheel="return imgScale(this)">
function imgScale(obj){
//alert(parseInt(obj.style.zoom,10));
var zoom = parseInt(obj.style.zoom,10)||100;
zoom += event.wheelDelta / 15;
if(zoom > 0 ){
obj.style.zoom=zoom+'%';
}else{
return false;
}
}
就是这么简单,但是没啥好的交互,但是功能可以实现
------------------------
function preview(id) {
var options = {
ratio: 0.6,
thumbBox: '.thumbBox',
spinner: '.spinner',
imgSrc: ctx + "system/attachment/view/" + id
}
var cropper = $('.imageBox').cropbox(options);
$('#btnZoomIn').on('click', function () {
cropper.zoomIn();
})
$('#btnZoomOut').on('click', function () {
cropper.zoomOut();
});
}