Jquery resize plugin min width depending on which edge is being dragged [duplicate]

余生长醉 提交于 2019-12-25 05:13:30

问题


Possible Duplicate:
Jquery resizable plugin, set minWidth depending on the dragging edge

How can i set the minWidth and height depending on which edge of the element is being dragged?


回答1:


Kind of a weird interaction, but here it is (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;
            }
        }
    });
});​


来源:https://stackoverflow.com/questions/10775703/jquery-resize-plugin-min-width-depending-on-which-edge-is-being-dragged

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!