2010-08-25 97 views

回答

5

您可以设置.height()并使用startstop事件,像这样.width()

$(".icon").draggable({ 
    start: function() { 
     $(this).height(100).width(100); //drag dimensions 
    }, 
    stop: function() { 
     $(this).height(50).width(50);  //original icon size 
    } 
});​ 

You can give it a try here,或a bit more compact

$(".icon").draggable({ 
    start: function() { 
     $(this).css({ height: 100, width: 100 }); 
    }, 
    stop: function() { 
     $(this).css({ height: 50, width: 50 }); 
    } 
});​ 
+0

我不知道http://dummyimage.com。很有用。 – user113716 2010-08-25 14:00:31

+0

太酷了,thx。最后一个问题。我想保留原始尺寸的原始图标? – Dooie 2010-08-25 14:01:38

+0

@Dooie - 你可以设置'helper:'clone''选项,这是你在找什么? http://jsfiddle.net/nick_craver/8QteZ/2/ – 2010-08-25 14:04:08

0

事件绑定到的dragstart和dragend,在这里看到的样品: Active Drag Demo (number 5)

并拖动开始与病程的图像会更大样式时addClass()和removeClass()拖动停止时。

+0

这是一个不同的拖动库中,OP是具体指的是jQuery UI Draggable,在这里找到:http://jqueryui.com/demos/draggable/ – 2010-08-25 13:54:33

相关问题