使用自定义处理程序模拟resizable()动作

时间:2013-06-11 16:48:13

标签: javascript jquery jquery-ui

我想使用我自己的动作处理程序将相同的重新调整元素应用于元素?让我们看看代码。

这是我的常规可调整大小的处理程序,具有类.resizable的任何元素都可以使用提供的param(animate,grid,zIndex)进行调整。

$('.resizable').resizable({
    animate: true,
    grid: [$(this).width(),$(this).height()],
    zIndex: 0
});

现在是我的自定义事件。我想让它在鼠标移动时模拟上面的内容。评论进一步解释。

$("#main").on('mousedown', function(e){

    // Create an new image element
    // and append it to the #danka div
    // and apply an mousemove event.

    appendTo('#danka').on("mousemove", function(e){

           // I need it so; as the mouse moves, 
           // it simulate the .resizable() event,
           // created above with all param.

    });

});

基本上我尝试移动鼠标(跟踪鼠标位置)并将其传递给.resizable()事件来处理实际的重新调整大小。

这可能吗?我看了trigger(),但似乎看不出它会如何起作用? 感谢。

0 个答案:

没有答案