简体   繁体   English

jQuery-Resizable:div的调整大小事件未触发

[英]jQuery-Resizable: Resize event of div is not triggered

I have the following code, which enables the resizing of two panels separated by a splitter-div (taken from this great example by Rick Strahl) 我有以下代码,该代码可以调整由splitter-div分隔的两个面板的大小(摘自Rick Strahl的出色示例

I'm trying to trigger a resize event but somehow this is not registered. 我正在尝试触发调整大小事件,但不知何故未注册。 Any ideas what I'm missing here? 有什么想法我在这里想念的吗? Thanks already. 谢谢了

   $(".flex-item-top").resizable({
      handleSelector: ".splitter",
      resizeWidth: false,
      resize: function(event, ui) {
        console.log("Let's get schwifty!")
      }
    })

CodePen CodePen

EDIT: A bit late, but I still haven't figured out why the event isn't firing. 编辑:有点晚了,但我仍然没有弄清楚为什么该事件没有触发。 However, for now I found a solution via a "drag" event, which I found in another Stack Overflow post, maybe it is helpful to someone :) 但是,到目前为止,我通过“拖动”事件找到了一个解决方案,该事件在另一个Stack Overflow帖子中找到,也许对某人有所帮助:)

var isDragging = false;
$(".splitter")
.mousedown(function() {
    isDragging = true;
})
.mousemove(function() {
  if (isDragging) {
     console.log('hello')
  } 
 })
.mouseup(function() {
    isDragging = false;
})

So what I found is that there is some sort of conflict between jQuery-UI and and the resizeable.js library that is called. 因此,我发现,jQuery-UI与所调用的resizeable.js库之间存在某种冲突。 When you omit the jQuery-UI library you get the splitter movement. 当您省略jQuery-UI库时,您会得到拆分器动作。

   <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
   <script type="text/javascript" src="https://rawgit.com/RickStrahl/jquery-resizable/master/src/jquery-resizable.js"></script>

These should be the only libraries you call. 这些应该是您调用的唯一库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM