代码之家  ›  专栏  ›  技术社区  ›  z33m

jqueryui可调整大小:单独使用east句柄时自动调整高度

  •  8
  • z33m  · 技术社区  · 15 年前

    height:auto

    resize: function(event, ui) {
        $(this).css('height', 'auto');
    }
    

    以防止设置高度。当只使用东把手时,有没有更好的方法来防止高度设置?

    1 回复  |  直到 15 年前
        1
  •  0
  •   Chris Lucian    14 年前

    尝试设置纵横比和句柄属性:

        $( "#resizable" ).resizable({
            aspectRatio: 16 / 9,
                        handles: 'e'
        });
    

    以下是文档站点的描述 http://jqueryui.com/demos/resizable/#option-containment :

    使用指定的handles选项初始化可调整大小。

    $( ".selector" ).resizable({ handles: 'n, e, s, w' });
    

    //getter
    var handles = $( ".selector" ).resizable( "option", "handles" );
    //setter
    $( ".selector" ).resizable( "option", "handles", 'n, e, s, w' );