【问题标题】:Jquery resize plugin min width depending on which edge is being dragged [duplicate]Jquery根据拖动的边缘调整插件最小宽度[重复]
【发布时间】:2012-05-27 16:57:42
【问题描述】:

可能重复:
Jquery resizable plugin, set minWidth depending on the dragging edge

如何根据被拖动元素的边缘设置 minWidth 和 height?

【问题讨论】:

  • 嗨,Ilya,仅供参考,您不应该double post。每当您编辑问题时,它都会重新回到顶部。因此,当我编辑您的其他问题以包含您的 jsfiddle 时,它​​再次将其撞到顶部,因此可见。对不起,我应该提到这一点。很高兴你找到了答案。 :)
  • 感谢您的提示。只是需要一个快速的答案,所以:P 但是我知道......

标签: javascript jquery jquery-ui jquery-plugins jquery-resizable


【解决方案1】:

有点奇怪的互动,但这里是 (jsfiddle)

$(function() {
    $( "#resizable" ).resizable({
        handles : 'e, n, s, w',
        resize : function(event, ui){
            switch($(this).data('resizable').axis)
            {
                case 'n':
                    $(this).resizable( "option", "minHeight", 75 );
                    break;
                case 's':
                    $(this).resizable( "option", "minHeight", 100 );
                    break;
                case 'e':
                    $(this).resizable( "option", "minWidth", 150 );
                    break;
                case 'w':
                    $(this).resizable( "option", "minWidth", 200 );
                    break;
            }
        }
    });
});​

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-16
    • 1970-01-01
    • 1970-01-01
    • 2011-12-07
    • 2020-10-19
    • 1970-01-01
    • 2014-06-28
    相关资源
    最近更新 更多