jquery-resizable - onDrag event not working

时间:2017-04-24 17:23:16

标签: javascript jquery jquery-plugins

I am using the jquery-resizable plugin, and I need to inject some code as soon as users stop dragging the splitter. As soon as I add the onDragEnd event, I am not able to drag the handles anymore! I am using the onDragEnd function as listed on Git. Any idea why I am not able to catch that event?

onDragEnd: function () {
     alert();
     return false;
});

Fiddle: https://jsfiddle.net/mvg0vdm8/2/

Plugin: https://github.com/RickStrahl/jquery-resizable

1 个答案:

答案 0 :(得分:0)

You have a syntax error, try this:

onDragEnd: function () {
     alert();
     return false;
}

Complete script (from your fiddle):

$(document).ready(function() {
  $(".panel-left").resizable({
    handleSelector: ".splitter",
    resizeHeight: false,
    onDragEnd: function () {
     alert();
     return false;
    }
  });

  $(".panel-top").resizable({
    handleSelector: ".splitter-horizontal",
    resizeWidth: false,
    onDragEnd: function () {
     alert();
     return false;
    }
  });
});