Jquery在调整大小时可调整显示大小



我正在构建一个jquery项目,人们可以在其中绘制地图,他们可以在地图上放置div,然后他们可以移动和调整大小。我想在一边的一个框,更新当前的宽度/高度的div,而他们正在调整它。目前它的工作,但它只更新后,他们完成调整大小,但我希望它更新,而他们正在调整它的实时

我当前的代码,只在调整大小时更新:

$(item).resizable({
            grid: Math.round(gridStand),
            stop : function(event,ui) {
                endW = Math.round($(this).outerWidth()/gridStand);
                endH = Math.round($(this).outerHeight()/gridStand);
                $(this).attr('w', endW).attr('h', endH)
                $('.standW').html('<h5>Breedte</h5><h4>'+($(item).attr('w')/2)+'</h4><span>meter</span>');
                $('.standH').html('<h5>Diepte</h5><h4>'+($(item).attr('h')/2)+'</h4><span>meter</span>')
                }
            })
            .draggable({
                grid: [ Math.round(gridStand), Math.round(gridStand) ],
                 containment: "#map", 
                 scroll: false,
                 stop : function(event,ui) {
                    endX = Math.round($(this).position().left/gridStand);
                    endY = Math.round($(this).position().top/gridStand);
                    $(this).attr('x', endX).attr('y', endY)
                }
            })

有人知道如何改变这一点,使它更新,而不是只有当你完成调整大小?

每次调整对象的大小发生变化时,都会触发resize事件。您将希望使用它而不是stop,后者仅在调整完成后触发一次。

最新更新