通过鼠标调整图像大小

时间:2011-03-03 10:24:44

标签: javascript jquery html

是否有任何jquery或其他品牌的插件可以使用鼠标调整div内的图像? 我查看了Jquery药物和插件,但还没找到任何合适的东西。

2 个答案:

答案 0 :(得分:3)

很容易创建自己,而不使用整个jQ UI lib。这是一个起始板:

var isDragging = false,
    $img = $('#myImg');

$img.bind('mousedown', function(e){
  isDragging = true;
  e.preventDefault();
});
$('body').bind('mousemove', function(e){
  if(isDragging)
    $img.css({ left: e.pageX, top: e.pageY });
}).bind('mouseup', function(){
  isDragging = false;
});

答案 1 :(得分:2)

相关问题